头文件:
1 #define _CRT_SECURE_NO_WARNINGS 2 #include <functional> 3 #include <algorithm> 4 #include <iostream> 5 #include <cstring> 6 #include <cassert> 7 #include <cstdio> 8 #include <cctype> 9 #include <vector> 10 #include <string> 11 #include <queue> 12 #include <stack> 13 #include <cmath> 14 #include <map> 15 #include <set> 16 using namespace std; 17 #define rep(i,a,n) for (int i=a;i<n;i++) 18 #define per(i,a,n) for (int i=n-1;i>=a;i--) 19 #define pb push_back 20 #define mp make_pair 21 #define all(x) (x).begin(),(x).end() 22 #define fi first 23 #define se second 24 #define SZ(x) ((int)(x).size()) 25 typedef vector<int> VI; 26 typedef long long ll; 27 typedef pair<int, int> PII; 28 const ll mod = 1000000007; 29 const double eps = 1e-6; 30 const double PI = acos(-1); 31 ll powmod(ll a, ll b) { ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; } 32 const int iadd[] = {0, 1, 0, -1}, jadd[] = {1, 0, -1, 0}; 33 const int inf = 0x3f3f3f3f; 34 const int maxn = 1e6 + 5;
如果有代码长度要求的话可能需要删除一些。
过多无用头文件会增加编译时间。
PI可能在不同编译环境下有冲突,math.h中定义了M_PI,但实际使用时多数OJ会报CE。