对拍

· · 科技·工程

对拍.cpp
#include<bits/stdc++.h>
using namespace std;
int main() {
    while(1) {
        system("ans.cpp");
        system("wa.cpp");
        system("std.cpp");
        if (system("fc wa.out std.out")) {
            break;
        }
    }
    return 0;
}
std.cpp
#include<bits/stdc++.h>
using namespace std;
int main() {
    freopen("ans.in", "r", stdin);
    freopen("std.out", "w", stdout);
    int a, b;
    cin >> a >> b;
    cout << a + b << "\n";
    return 0;
}
ans.cpp
#include<bits/stdc++.h>
using namespace std;
int main() {
    freopen("ans.in", "w", stdout);
    int flag = (rand()%100+1) == 1 ? -1 : 1;
    int a = flag * rand() % 1000 + 1;
    int b = rand() * 1000 + 1;
    cout << a << " " << b;
    return 0;
}
wa.cpp
#include<bits/stdc++.h>
using namespace std;
int main() {
    freopen("ans.in", "r", stdin);
    freopen("wa.out", "w", stdout);
    int a, b;
    cin >> a >> b;
    cout << abs(a + b) << "\n";
    return 0;
}