其他分享
首页 > 其他分享> > 对拍

对拍

作者:互联网

有关对拍

\(prework\)

你需要随机数生成器.exe,sol.exe,bruteforce.exe,以及对拍.exe

\(code\)

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

#define int long long 

const int mod=1e9;

signed main(){
	freopen("in.in","w",stdout);
	int x=rand()*rand()%mod*rand()%mod*rand()%mod+1;
	int y=rand()*rand()%mod*rand()%mod*rand()%mod+1;
	cout<<x<<" "<<y<<endl;
}

//sol.cpp
#include<bits/stdc++.h>
int main()
{	
	freopen("in.in","r",stdin);
	freopen("1.out","w",stdout);
    int a,b;
    scanf("%d%d",&a,&b);
    printf("%d",a+b);
    return 0;
}

//bruteforce.cpp
#include<bits/stdc++.h>
using namespace std;
int main()
{	
	freopen("in.in","r",stdin);
	freopen("2.out","w",stdout);
    int a,b;
    cin>>a>>b;
    cout<<a+b;
    return 0;
}

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

inline int read(){
	int x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*f;
}

int main(){
	freopen("result.out","w",stdout);
	for(int T=1;T<=10000;++T){
		system("D:\\rand.exe");
		double st=clock();
		system("D:\\sol.exe");
		double ed=clock();
		system("D:\\vio.exe");
		if(system("fc D:\\1.out D:\\2.out")){
			printf("Wrong Answer on #%d test, use time: %.01fms\n",T,ed-st);
			return 0;
		}
		else{
			printf("Accpeted on #%d test, use time: %.01fms\n",T,ed-st);
		}
	}	
}

\(duipai\)

这个时候你只需要运行duipai.exe就可以了!

P.S. 所有文件都得放在同一个目录下

标签:,rand,ch,int,exe,freopen,mod
来源: https://www.cnblogs.com/into-qwq/p/16460109.html