1.设置环境:-Wl,-stack=512000000 -Wall -Wextra -Wconversion
2.一定设置自动保存!!!
3.对拍程序:a+b problem为例
正解1:
#include<bits/stdc++.h> using namespace std; int n,m; int main() { cin>>n>>m; cout<<n+m<<endl; return 0; }
正解2:
#include<bits/stdc++.h> using namespace std; /* inline int read() { int ret=0;char ch=0,pre=0; do pre=ch,ch=getchar();while((ch<'0')||(ch>'9')); do ret=ret*10+ch-'0',ch=getchar();while((ch>='0'&&ch<='9')); if(pre=='-') ret=-ret; return ret; }*/ inline int read() { int ret=0;char ch=0,pre=0; do pre=ch,ch=getchar();while((ch<'0')||ch>'9'); do ret=ret*10+ch-'0',ch=getchar();while((ch>='0')&&(ch<='9')); if(pre=='-') ret=-ret; return ret; } int n,m; int main() { n=read();m=read(); printf("%d ",n+m); return 0; }
随机数:
#include<bits/stdc++.h> using namespace std; int main() { srand(time(0)); cout<<rand()%15564<<" "<<rand()%545345; }
对拍:
#include<bits/stdc++.h> using namespace std; int main() { while(1) { system("suijishu>in.txt"); system("a+b<in.txt>out.txt"); system("4578<in.txt>ans.txt"); if(system("fc out.txt ans.txt")) break; } return 0; }
4.一定用万能头!!!
5.快读:
inline int read() { int ret=0;char ch=0,pre=0; do pre=ch,ch=getchar();while((ch<'0')||ch>'9'); do ret=ret*10+ch-'0',ch=getchar();while((ch>='0')&&(ch<='9')); if(pre=='-') ret=-ret; return ret; }
随时补充
-----------end-------------