C++竞赛常用的头文件

根据C++ 竞赛常用的头文件关于#include <bits/stdc++.h>等整理

#include <bits/stdc++.h>  //万能头文件

万能头文件在国外的主流oj,台湾的oj,Codeforces和Topcoder这些都已经支持,国内HDU也支持,只不过POJ还不支持,语言要选择g++。

#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <string>          //字符串类
#include <iostream>        //基本输入输出流
#include <iomanip>
#include <sstream>         //基于字符串的流
#include <stdexcept>     //标准异常类
#include <algorithm>       //通用算法
#include <cmath>           //数学运算
#include <numeric>
#include <functional>    //定义运算函数(代替运算符)
#include <complex>      //复数类
#include <list>       //线性列表容器
#include <vector>          //动态数组容器
#include <stack>       //堆栈容器
#include <queue>       //队列容器
#include <deque>           //双端队列容器
#include <bitset>          //比特集合
#include <set>        //集合容器
#include <map>        //映射容器
#include <unordered_set>
#include <unordered_map>
#include <random>
#include <ctime>

using namespace std;

#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ALL(a) (a).begin(),(a).end()
#define FOR(w, a, n) for(int w=(a);w<(n);++w)
#define RFOR(w, a, n) for(int w=(n)-1;w>=(a);--w)
#define REP(w, n) for(int w=0;w<int(n);++w)
#define RREP(w, n) for(int w=int(n)-1;w>=0;--w)
#define IN(a, x, b) (a<=x && x<b)
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
const int MAXN = 100;

int main() {
    cout << "Hello, ACM." << endl;
    return 0;
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容