ACM数据对拍程序

#include<cstdio>
#include<cstdlib>
#include<ctime>
 
int main()
{   long s,t;
    while(1){
        system("cls");
        do{
            system("data.exe > data.txt"); //data是数据生成程序,自己写
            s=clock();
            system("2.exe < data.txt > try2.out");  //a是要测试的程序
            t=clock();
            system("1.exe < data.txt > try1.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);  //运行时间 wa了会停止对拍,wa的那一组会在data.txt里,所以说为了方便查找一次不要生成太大量的数据
        system("fc try1.out try2.out");
        system("pause>nul");
    }
    return 0;
}

  

posted @ 2018-08-17 14:23  Thanks_up  阅读(310)  评论(0编辑  收藏  举报