需要四个程序, 分别是 random.cpp, sol.cpp, bf.cpp, pai.cpp
random.cpp
#include <bits/stdc++.h>
#include <ctime>
using namespace std;
typedef long long LL;
const LL INF = 0x3f3f3f3f3f3f3f3f;
const LL inf = 0x3f3f3f3f;
LL randrom(LL n)
{
return (long long) rand() * rand() * rand() * rand() % n;
}
int main()
{
freopen("data.in", "w", stdout);
srand((unsigned)time(0));
printf("%lld %lld\n", randrom(inf), randrom(inf));
fclose(stdout);
return 0;
}
sol.cpp
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main()
{
freopen("data.in", "r", stdin);
freopen("data.out", "w", stdout);
LL a, b; scanf("%lld %lld", &a, &b);
printf("%lld\n", a + b);
fclose(stdin);
fclose(stdout);
return 0;
}
bf.cpp
#include <bits/stdc++.h>
using namespace std;
int main()
{
freopen("data.in", "r", stdin);
freopen("data.ans", "w", stdout);
int a, b; scanf("%d %d", &a, &b);
printf("%d\n", a + b);
fclose(stdin);
fclose(stdout);
}
pai.cpp
#include <bits/stdc++.h>
#include <cstdlib>
#include <cstdio>
#include <ctime>
using namespace std;
void print(FILE *f)
{
char ch = fgetc(f);
while(ch != EOF){
printf("%c", ch);
ch = fgetc(f);
}
}
int main()
{
for(int T = 1; T <= 10000; T++){
system("random.exe");
double st = clock();
system("sol.exe");
double et = clock();
system("bf.exe");
int flag = system("fc data.out data.ans");
if(flag)
puts("Wrong Answer");
else
printf("Accepted, Points: #%d, Time: %.0fms\n", T, et - st);
FILE *f1 = fopen("data.in", "r");
FILE *f2 = fopen("data.out", "r");
FILE *f3 = fopen("data.ans", "r");
puts("Input"); print(f1);
puts("Output_sol"); print(f2);
puts("Output_bf"); print(f3);
if(flag) break;
}
fclose(stdin);
fclose(stdout);
return 0;
}