天天看点

对拍

对拍

步骤:

1.先写出自己的代码并运行

2.写出暴力代码并运行

#include<cstdlib>
#include<ctime>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
int main(){
    srand(time(0));
    freopen("in.in", "w", stdout);
    int a = rand(), b = rand();
    printf("%d %d\n", a, b);
}
           
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<ctime>
using namespace std;
int main(){
    while(1){
        system("data.exe");
        system("baoli.exe");
        double begin=clock();
        system("std.exe");
        double end=clock();
        printf("运行时间%.4lf",(end-begin)/1000);
        if (system("fc std.txt baoli.txt")) //当 fc 返回1时,说明这时数据不一样
            break;                          //不一样就跳出循环
        cout<<"找不到差异"<<endl<<endl;
    }
    return 0;
}
           
上一篇: 对拍
下一篇: 对拍