对拍
Atserckcn
·
·
个人记录
假设考试时我的程序(疑似正解)
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int a,b;
int main(){
scanf("%d%d",&a,&b);
printf("%d\n",a+b);
return 0;
}
暴力程序
#include<bits/stdc++.h>
using namespace std;
int a,b,s;
int main(){
scanf("%d%d",&a,&b);
while(a--) s++;
while(b--) s++;
printf("%d\n",s);
return 0;
}
生成随机数程序
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main(){
a=rand()%100005;
b=rand()%10000;
printf("%d %d",a,b);
return 0;
}
对拍程序
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int t,s;
int main(){
while(true)
{
system("data.exe > in.txt");
s=clock();
system("my.exe < in.txt > out.txt");
t=clock();
system("std.exe < in.txt > std.txt");
if(system("fc out.txt std.txt")) break;
printf("AC time: %d\n",t-s);
}
printf("WA time: %d\n",t-s);
return 0;
}
附上截图: