如何对拍程序

学术版

[___ _ ___](https://blog.csdn.net/c20190102/article/details/60138907)
by jzzcjb @ 2018-07-22 15:02:46


下面是我用的对拍器…… 将"maker","checker","run","std"放到同一个文件夹下 然后新建一个sed.txt文件,写一个你喜欢的数字例如19260817 然后新建一个rot.txt文件,写一个n,m的范围 然后这是checker的代码 ```C #include<cstdio> #include<cstdlib> using namespace std;int n;int m; int main() { printf("start cmp^\n");int t=0; do { printf("t=%d\n",++t); system("maker.exe"); system("std.exe"); system("run.exe"); }while(system("fc mans.txt sans.txt")==0); printf("find differ please ck\n"); return 0; } ``` maker是数据生成器,在前面加上这几句 ```C freopen("sed.txt","r",stdin);scanf("%d",&se);srand(se);fclose(stdin); freopen("sed.txt","w",stdout);printf("%d",rand()^time(0));fclose(stdout); freopen("root.txt","r",stdin);//scanf("%d",&n); freopen("tst.txt","w",stdout); ``` 之后正常ran数据 run是你的程序,在前面加上这几句 ```C freopen("tst.txt","r",stdin);freopen("mans.txt","w",stdout); ``` std是题解,在前面加上这几句 ```C freopen("tst.txt","r",stdin);freopen("sans.txt","w",stdout); ``` 然后启动运行cheker.exe就行了
by shadowice1984 @ 2018-07-22 15:05:31


@[rainman](/space/show?uid=55804) 233
by shadowice1984 @ 2018-07-22 15:06:15


@[shadowice1984](/space/show?uid=56384) @[jzzcjb](/space/show?uid=57304) 感谢
by xiangling @ 2018-07-22 15:14:31


@[rainman](/space/show?uid=55804) 注意一下srand(time)的话会导致一秒钟只有一组数据,可能会慢…… 另外关360对拍
by shadowice1984 @ 2018-07-22 15:16:10


@[rainman](/space/show?uid=55804) https://www.cnblogs.com/ztz11/p/9343694.html
by ztz11 @ 2018-07-22 15:21:18


@[ztz11](/space/show?uid=52176) 感谢
by xiangling @ 2018-07-22 15:22:59


学到了,谢谢!
by cwtcwt @ 2019-07-11 19:56:51


学到了,谢谢!
by Celestial_Scarlet @ 2020-11-12 21:55:17


|