第十屆四川省ACM賽前總結
PS:(頭腦風暴,想到什麽,寫什麽)
1、1e10 == 1 * 10 ^ (10)
2、ArithmeticException == 算術異常
3、 BigInteger a = new BigInteger("12");
BigInteger.valueof("12"); // 都是對Biginteger進行初始化
加法:add
減法:substract
乘法:multiply
除法:divide
大數的最大公約數:gcd
etc...
4、同余定理實用於 “加法”、“乘法”,eg:(a+b)%p = ((a%p) + (b%p))%p
5、可以通過map<int, string, greater<int> >,定義map容器,以降序排列
6、priority_queue <int, vector<int>, cmp> q; // 優先隊列
priority_queue <long, vector<long>, greater<long> > q; // 優先隊列
priority_queue <node> q; //優先隊列
bool operator < (const node a, const node b)
{
return a.cnt > b.cnt;
}
7、a<<=1; 等價於 a*=2;
a>>=1; 等價於 a/=2;
8、getline(cin, s); // 以行為單位輸入字符串
9、atof // String轉化為float型
10、stable_sort(A, A+n, cmp); // 穩定排序
11、isalnum(); // 判斷輸入的字符串是否為字母或數字
12、ceil(x); // 大於x的最小整數 (向上取整)
13、floor(x); //小於或等於x的最大整數 (向下取整)
14、sscanf("123456fff", "%d", &n); // 其中 n = 123456
15、printf("%.*lf", x, a); // 將a按照x位小數縮進
16、ios::sync_with_stdio(false); // 加快cin、cout的速度
17、Itoa(int temp, char*, int n) ;// 將temp轉化成n進制的數放在char* 中
18、並查集pre, my_find(); my_join();
19、KMP,AC自動機
第十屆四川省ACM賽前總結