算法竞赛常用小技巧
常用小技巧
1. 将cin 和cout 输入输出时间减小到跟scanf和printf差不多:
int main (){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
2. 涉及到文件的输入输出:
#include<stdio.h>
int main()
{
    int a,b;
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    while(scanf("%d %d",&a,&b)!=EOF)
    printf("%d\n",a+b);
} //运行后直接自动建立了一个out.txt文本在程序目录下

 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号