RocksonLee's Blog
avatar
RocksonLee
2021-09-15 16:21:37
  • 本文总阅读量

对拍程序

首先需要将造数据的data.exe加上

freopen("data.in","r",stdout);

主程序

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a1,a2,b1,b2;
    while (1)
    {
        system("data.exe > data.in");//data.exe 生成数据
        a1=clock();
        system("program.exe < data.in > program.out");
        a2=clock();

        b1=clock();
        system("std.exe < data.in > std.out");
        b2=clock();
        cout<<"t1="<<a2-a1<<"ms"<<endl<<"t2="<<b2-b1<<"ms"<<endl;
        if (system("fc program.out std.out")) system("pause");
    }
}
对拍
comment评论
Search
search