对拍与数据生成(A+B problem)

//对拍
#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;
}
//数据
#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;
}

//
标程 #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; }
//测试
#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%5==0){
            printf("%d\n",a);
            return 0;
      }
      printf("%d\n",a+b);
      return 0;
}

当然测试代码有一个地方是错的。

猜你喜欢

转载自www.cnblogs.com/DZN2004/p/13193011.html