在程序中加入测试代码
freopen ( "test.in", "r", stdin); //读入数据
freopen("test.out", "w", stdout);//输出数据
fstream fin("test.in");//读入数据
ofstream fout("test.out");//输出数据

万能头文件
#include <bits/stdc++.h>
using namespace std; //使用cin进行读入,cout进行读出时需加

计时——clock函数
clock_t start , finish ;
start = clock();
finish = clock();
cout << (double)(finish - start) / CLOCKS_PER_SEC << endl;

例:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int i,k;
int n= 10e8;
clock_t start , finish ;
start = clock();
for(i=0;i<n;i++){
    k++;
}
finish = clock();
cout << (double)(finish - start) / CLOCKS_PER_SEC << endl;
return 0;
}

cout输出保留一位小数
cout << fixed << setprecision(1) << ▒▒ << endl;

判断一个字符串是否在另一个字符串中
string :: size_tytpe idx
idx = a.find(b);
if ( idx == string :: npos){ //不存在
}

帮助检测网站 Udebug

截取字符串
s.substr()

自定义类型——typedef

清空数组内的元素
memset(a,0,sizeof(a));

定义一个点结构体类型
struct point{
int x,y;
};

关于string
输入可用 getline(cin,s);
统计
int cnt(0); // int cnt = 0;
while(getline(cin,s)){
stringstream ss(s);
string ts;
while(ss > ts){
    cnt++;
}
}