萬江做網(wǎng)站百度搜索引擎優(yōu)化的推廣計(jì)劃
文章目錄
- C++
- 頭文件
- 自定義排序函數(shù)
- stl
- 算法
- 數(shù)據(jù)結(jié)構(gòu)
- 樹狀數(shù)組
- 數(shù)學(xué)
自用隨便記錄
C++
排序
stl
頭文件
全能頭文件:
#include<bits/stdc++.h>
自定義排序函數(shù)
bool compare(const int &odd1,const int &odd2)
{return odd1>odd2;
}
stl
枚舉map
map<int, string> mapStudent; mapStudent.insert(pair<int, string>(1, "student_one")); mapStudent.insert(pair<int, string>(2, "student_two")); mapStudent.insert(pair<int, string>(3, "student_three")); map<int, string>::reverse_iterator iter; for(iter = mapStudent.rbegin(); iter != mapStudent.rend(); iter++) { cout<<iter->first<<" "<<iter->second<<endl; }
優(yōu)先隊(duì)列
算法
堆
數(shù)據(jù)結(jié)構(gòu)
堆
圖
樹狀數(shù)組
數(shù)學(xué)
快速冪
gcd和最小公倍數(shù)(ab的最小公倍數(shù)=ab/gcd(ab))
int gcd(int x, int y){if(x<y) return gcd(y, x);return y == 0?x:gcd(y, x%y);
}
ex_gcd
質(zhì)數(shù)