对拍程序

代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include<bits/stdc++.h>
using namespace std;
#define maxn 1000010
char ans[maxn][55];
char ac[maxn][55];
char s[55];
int main() {
int a=0,b=0;
freopen("ac.txt","r",stdin);
while(gets(s)) strcpy(ac[a++],s);
freopen("ans.txt","r",stdin);
while(gets(s)) strcpy(ans[b++],s);
if(a!=b) printf("Error!\n");
else {
int wa=0;
for(int i=0; i<a; i++) {
if(strcmp(ans[i],ac[i])!=0) {
printf("%d : %s / %s\n",i+1,ac[i],ans[i]);
wa++;
}
}
printf("wrong answer : %d\n",wa);
}
return 0;
}