An incorrect understanding of the meaning of the question. It should be a game. Only one set of answer sequences are input, and multiple groups of test sequences are input, the previous misunderstanding is that each input corresponds to a set of answer sequences and a set of test sequences. The following is the code after understanding the question, but it is still wa, to be modified.
#include<stdio.h>#define maxn 1010int main(){ int num,a[maxn],i,j,b[maxn]; int sum=0; while(scanf("%d",&num)!=EOF&&num) { ++sum; printf("Game %d:\n",sum);for(i=0;i<num;i++) { scanf("%d",&a[i]); } for(;;) {int s1=0,s2=0;for(i=0;i<num;i++) { scanf("%d",&b[i]); if(a[i]==b[i]) { s1++; } } if(b[0]==0){break; } int c1=0,c2=0; for(int d=0;d<10;d++) { for(i=0;i<num;i++) { if(a[i]==d) c1++; if(b[i]==d) c2++; } } if(c2>c1) s2+=c1; else s2+=c2; printf(" (%d,%d)\n",s1,s2-s1);} }}
Uva340 after understanding the meaning of the question