对拍

Linux下的对拍代码

data.cpp

#include <bits/stdc++.h>
using namespace std;
int main() {
    freopen("data.in", "w", stdout);
    srand(time(NULL));
}

dp.cpp

#include <bits/stdc++.h>
using namespace std;
int main(){
    int T = 10000;
    int tot = 0;
    system("g++ 1.cpp -o 1; g++ std.cpp -o std; g++ data.cpp -o data");
    while(T--){
        tot++;
        cout << tot << "--->";
        system("./data; ./1; ./std");
        if(system("diff 1.out std.out")){
            cout << "WA" << endl;
            return 0;
        }
        else 
            cout << "AC" << endl;
    }
}
原文地址:https://www.cnblogs.com/Z8875/p/13178750.html