程序中的计时
#include<time.h>
printf("Time used=.%2lf\n" ,(double)clock() / CLOCKS_PER_SEC);
Π(圆中的 pai 的表示)
#include<math.h>
const double pi = acos(-1.0);
算法竞赛中的输入输出框架
重定向版
#define LOCAL //提交前删除本行就可以
#ifdef LOCAL
freopen("datain.txt","r",stdin);
freopen("dataout.txt","w",stdout);
#endif
fopen版
int main(){
FILE *fin,*fout;
fin=fopen("datain.txt","rb");
fout=fopen("dataout.txt","wb");
int a,b;
while(fscanf(fin,"%d%d",&a,&b)==1)
fprintf(fout,"%d\n",a+b);
fclose(fin);
fclose(fout);
return 0;
}
strchr 的作用是在一个字符串中查找单个字符,会返回查询的自符以及查询的字符之后的所有字符
<