Linux下对拍(A+B问题)

对拍代码

#include<bits/stdc++.h>
using namespace std;
int main(){
      for(int i=1;;i++){
            system("./data");
            system("./std");
            system("./test");
            if(system("diff test.out std.out")){
                  printf("Wrong Answer! No:%d\n",i);
                  break;
            } else {
                  printf("Accepted. No:%d\n",i);
            }
      }
      return 0;
}

数据代码(data.cpp)

#include<bits/stdc++.h>
using namespace std;
int main(){
      freopen("data.in","w",stdout);
      srand(time(NULL));
      int a=rand()%100+1;
      int b=rand()%100+1;
      printf("%d %d\n",a,b);
      return 0;
}

暴力代码(std.cpp)

#include<bits/stdc++.h>
using namespace std;
int main(){
      freopen("data.in","r",stdin);
      freopen("std.out","w",stdout);
      int a,b;
      scanf("%d%d",&a,&b);
      printf("%d\n",a+b);
      return 0;
}

测试代码(test.cpp)

#include<bits/stdc++.h>
using namespace std;
int main(){
      freopen("data.in","r",stdin);
      freopen("test.out","w",stdout);
      int a,b;
      scanf("%d%d",&a,&b);
      if(a%50==0){
            printf("%d\n",a);
            return 0;
      }
      printf("%d\n",a+b);
      return 0;
}

Linux下对拍(A+B问题)

上一篇:物联网设备日益增多 企业需部署哪些安全策略


下一篇:linux集群部署深度学习平台Pytorch