zoukankan      html  css  js  c++  java
  • 对拍程序编写

    1.首先将BL.cpp编写,再将AC.cpp编写出来,前提条件为BL一定是对的

    2.BLAC的重定向进行更改,将.in指向make.out,.out更改为文件名+number.out,运行两个程序,产生exeout

    3.编写一个数据生成器.cpp,用时间做种子srand(time(0)),注意随机函数要用<Cstdlib>,时间种子需要<ctime>,运行程序,产生exeout

    4.编写对拍核查程序

    5.所有的文件输入输出与文件名必须是英文

    以下适合Windows:

    标准程序

    #include<cstdio>
    #include<iostream>
    #define FORa(i,s,e)    for(i=s;i<=e;i++)
    #define FORs(i,s,e)    for(i=s;i>=e;i--)
    #define File(name) freopen(name".in","r",stdin); freopen(name".out","w",stdout);
    using namespace std;
    static char buf[100000],*pa=buf,*pb=buf;
    #define gc pa==pb&&(pb=(pa=buf)+fread(buf,1,100000,stdin),pa==pb)?EOF:*pa++
    inline int read();
    int main()
    {
        freopen("make.in","r",stdin); 
        freopen("1.out","w",stdout);
        int a,b;
        a=read(),b=read();
        cout<<a+b;
        return 0;
    }
    inline int read()
    {
        register int x(0);register int f(1);register char c(gc);
        while(c<'0'||c>'9')f=c=='-'?-1:1,c=gc;
        while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=gc;
        return f*x;
    }
    View Code

     检验程序

     1 #include<cstdio>
     2 #include<iostream>
     3 #define FORa(i,s,e)    for(i=s;i<=e;i++)
     4 #define FORs(i,s,e)    for(i=s;i>=e;i--)
     5 #define File(name) freopen(name".in","r",stdin); freopen(name".out","w",stdout);
     6 using namespace std;
     7 static char buf[100000],*pa=buf,*pb=buf;
     8 #define gc pa==pb&&(pb=(pa=buf)+fread(buf,1,100000,stdin),pa==pb)?EOF:*pa++
     9 inline int read();
    10 int main()
    11 {
    12     freopen("make.in","r",stdin);
    13      freopen("2.out","w",stdout);
    14      int a,b;
    15      a=read(),b=read();
    16      cout<<a+b-1;
    17     return 0;
    18 }
    19 inline int read()
    20 {
    21     register int x(0);register int f(1);register char c(gc);
    22     while(c<'0'||c>'9')f=c=='-'?-1:1,c=gc;
    23     while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=gc;
    24     return f*x;
    25 }
    View Code

    数据生成器

     1 #include<ctime>
     2 #include<cstdio>
     3 #include<cstdlib>
     4 #include<iostream>
     5 #define FORa(i,s,e)    for(i=s;i<=e;i++)
     6 #define FORs(i,s,e)    for(i=s;i>=e;i--)
     7 #define File(name) freopen(name".in","r",stdin); freopen(name".out","w",stdout);
     8 using namespace std;
     9 static char buf[100000],*pa=buf,*pb=buf;
    10 #define gc pa==pb&&(pb=(pa=buf)+fread(buf,1,100000,stdin),pa==pb)?EOF:*pa++
    11 inline int read();
    12 int main()
    13 {
    14     freopen("make.in","w",stdout);;
    15     srand(time(0));
    16     cout<<rand()%100<<" "<<rand()%100;
    17     return 0;
    18 }
    19 inline int read()
    20 {
    21     register int x(0);register int f(1);register char c(gc);
    22     while(c<'0'||c>'9')f=c=='-'?-1:1,c=gc;
    23     while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=gc;
    24     return f*x;
    25 }
    View Code

    对拍程序

     1 #include<cstdio>
     2 #include<iostream>
     3 #define FORa(i,s,e)    for(i=s;i<=e;i++)
     4 #define FORs(i,s,e)    for(i=s;i>=e;i--)
     5 #define File(name) freopen(name".in","r",stdin); freopen(name".out","w",stdout);
     6 using namespace std;
     7 static char buf[100000],*pa=buf,*pb=buf;
     8 #define gc pa==pb&&(pb=(pa=buf)+fread(buf,1,100000,stdin),pa==pb)?EOF:*pa++
     9 inline int read();
    10 int main()
    11 {
    12     int s=0;
    13     while(1)
    14     {
    15         system("make.exe");
    16         system("1.exe");
    17         system("2.exe");
    18         if(system("fc 1.out 2.out"))
    19             system("pause");
    20         else
    21             cout<<++s<<endl;
    22     }
    23     return 0;
    24 }
    25 inline int read()
    26 {
    27     register int x(0);register int f(1);register char c(gc);
    28     while(c<'0'||c>'9')f=c=='-'?-1:1,c=gc;
    29     while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=gc;
    30     return f*x;
    31 }
    View Code

    感谢各位与信奥一本通的鼎力相助!

  • 相关阅读:
    python第一个项目:爬取一个网站的所有图片
    python学习笔记(3)
    python学习笔记(3)
    python学习笔记(2)
    python学习笔记(2)
    机器学习入门(1)
    centos7安装google-chrome
    linux 系统监控命令之 top-(转自 Howie的专栏)
    linux 磁盘管理命令之df-(转自 Howie的专栏)
    sizeof()用法汇总-(转自风雷)
  • 原文地址:https://www.cnblogs.com/SeanOcean/p/10975527.html
Copyright © 2011-2022 走看看