zoukankan      html  css  js  c++  java
  • 实现对拍

    总体

    对拍是一种适用于所有选手的一种验证错误的方法,可以用这种方法来实现错误与否。

    可分为4个源代码。

    我们用个A+Bproblem举例

    自己的代码

    #include<iostream>
    using namespace std;
    int main()
    {
    int a,b;
    cin>>a>>b;
    cout<<a+b;
    }
    

    暴力的代码

    #include<iostream>
    using namespace std;
    int main()
    {
    int a,b,c;
    cin>>a>>b;
    c=a+b;
    cout<<c;
    }  

    接下来是随机数生成器

    #include <ctime>
    #include <cstdio>
    #include <cstdlib>
    #include <iostream>
    using namespace std;
    int main()
    {
        srand(time(0));
        int a = rand()%0217;
        int b = rand()%1112;
        printf("%d %d",a,b);
        return 0;
     }
    

    最后是对拍程序

     #include <windows.h>
     #include <cstdio>
     #include <cstdlib>
     #include <iostream>
     using namespace std;
     int main()
     {
         int T = 1000;
         while(T--)
         {
             system("randdata > try.in");
             system("try1 < try.in > try1.out");
             system("try2 < try.in > try2.out");
             if(system("fc try1.out try2.out")) break;
         }
         system("pause");
         return 0;
     }
    

      

      

     

  • 相关阅读:
    数据库中表的主键的定义
    软件的三大类型
    常用逻辑公式
    软件开发中常用英文含义
    2017.11.27T19_8zuoye
    2017.11.29T19_B1_9zuoye chihuolianmeng
    2017.12.1T19_B2_1zuoye
    2017.12.6T19_B2_3.4
    2017.12.1T19_B2_2zuoye
    2017.12.6T19_B2_3.2 zuoye
  • 原文地址:https://www.cnblogs.com/liuwenyao/p/8496064.html
Copyright © 2011-2022 走看看