0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Macで<stdc++.h>を使えるようにする簡単な方法

Last updated at Posted at 2020-11-16

stdc++.hを作る

$ brew install gcc
$ mkdir /usr/local/include/bits
$ vi /usr/local/include/bits/stdc++.h

stdc++.hの中身をコピーする.
stdc++.hへ書き込む. (行番号をエディタなどで削除.)

stdc++.hが機能しているか確認する

#include <bits/stdc++.h>
using namespace std;

int main() {
  freopen("IO_in1.txt", "r", stdin);
  int TC;
  vector<int> v;
  scanf("%d", &TC); // number of test cases
  while (TC--) { // shortcut to repeat until 0
    int a, b, c; scanf("%d %d %d", &a, &b, &c);
    v.push_back(a);
    v.push_back(b);
    v.push_back(c);
    sort (v.begin(), v.end()); 
    printf("%d %d %d\n", v[0], v[1], v[2]); // compute on the fly
  }
  return 0;
}

TC_in1.txtを書く

1
3 5 1

実行

$ g++ io.cpp
$ ./a.out

1 3 5と出てきたら成功.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?