作为一名OIer,比赛时,对拍是必须的 不对拍,有时可以悔恨终身
首先,对拍的程序 一个是要交的程序 另一个可以是暴力、搜索等,可以比较慢,但是必须正确
下面是C++版对拍程序(C++ & cmd) 注意:所有程序不用加文件输入输出
#include<cstdio> #include<cstdlib> #include<ctime> int main() { long s,t; while(1){ system("cls"); do{ system("data > try.in"); //data是数据生成程序 s=clock(); system("a < try.in > try1.out"); //a是要交的程序 t=clock(); system("b < try.in > try2.out"); //b是正确的程序 if(system("fc try1.out try2.out > nul")) break; else printf("AC time: %ldms\n",t-s); }while(1); printf("WA time: %ldms\n",t-s); //运行时间 system("fc try1.out try2.out"); system("pause>nul"); } return 0; }