当前位置: 移动技术网 > IT编程>开发语言>C/C++ > CSP(noip)中的简单对拍写法

CSP(noip)中的简单对拍写法

2019年10月19日  | 移动技术网IT编程  | 我要评论

福建泰顺棋牌俱乐部,美女小说,野外求生惨死

以a+b为例

这是随机数据

#include<iostream>
#include<cstdio>
#include<ctime>
using namespace std;
int main(){
    freopen("rand.txt","w",stdout);
    int a,b;
    srand(time(0));
    a=rand()%10+1;b=rand()%10+1;
    cout<<a+b;
}

这是正解(假设它是正解!)

#include<iostream>
#include<cstdio>
#include<ctime>
using namespace std;
int main(){
    freopen("rand.txt","r",stdin);
    freopen("1.txt","w",stdout);
    int a,b;
    cin>>a>>b;
    cout<<a+b;
}

这是暴力(假设它是暴力)

#include<iostream>
#include<cstdio>
#include<ctime>
using namespace std;
int main(){
    freopen("rand.txt","r",stdin);
    freopen("2.txt","w",stdout);
    int a,b;
    cin>>a>>b;
    cout<<a+b;
}

最后就是对拍了

#include<bits/stdc++.h>
using namespace std;
int main(){
    while(1){
        system("rand.exe");
        system("1.exe");
        system("2.exe");
        if(system("fc 1.txt 2.txt"));
        while(1);
    }
}

 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网