对拍的基本理论这里恕我不一一叙述,不会的请转身到这里:http://blog.csdn.net/code12hour/article/details/51252457
分为以下几个部分:
1、暴力伪标程(baoli)
1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 int a,b; 7 cin >> a >> b; 8 cout << a+b << endl; 9 return 0; 10 }
2、自己的程序(me)
1 #include <stdio.h> 2 3 int main() 4 { 5 int a, b; 6 scanf("%d %d",&a, &b); 7 printf("%d ", a+b); 8 return 0; 9 }
3、数据生成器(gen)
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <algorithm> #include <windows.h> using namespace std; int main() { srand(time(0)); int a,b; a=rand()%100+1,b=rand()%100+1; printf("%d %d ",a,b); return 0; }
4、对拍
:again gen > input.txt baoli < input.txt > baoli_output.txt me < input.txt > me_output.txt fc baoli_output.txt me_output.txt if not errorlevel 1 goto again pause