對拍模板

windows版

#include<cstdio>
#include<iostream>
#include<ctime>
using namespace std;

double times,times2;
int main(){
    int t = 0;
    while ( true ){
        system("datamaker.exe");
        times = clock();
        system("4327.exe < input.txt > 1.out");
        times = clock() - times;
        times2 = clock();
        system("std.exe < input.txt > 2.out");
        times2 = clock() - times2;
        if ( system("fc 1.out 2.out > log.txt") ){
            system("pause");
            break;
        }
        cout<<"correct "<<++t<<endl;
        cout<<times / 1000<<" "<<times2 / 1000<<endl;
    }
    return 0;
}

LINUX 版

#include<bits/stdc++.h>
#include<ctime>
using namespace std;

double times,times2;
int main(){

    int t = 0;
    while ( true ){
        system("./datamaker");
        times = clock();
        system("./B < input.txt > 1.out");

        times2 = clock();
        system("./std < input.txt > 2.out");
        times2 = clock() - times2;
        if ( system("diff 1.out 2.out > log.txt") ){
            system("pause");
            break;
        }   
        cout<<"correct "<<++t<<endl;
        cout<<times / 1000<<" "<<times2 / 1000<<endl;

        }
    return 0;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章