题目很简单。
下面的是AC的代码:
#include <iostream>
using namespace std;
const int MAX = 1010;
int main()
{
// freopen("340.txt", "r", stdin);
int a[MAX], b[MAX];
int i, j, n, A, B;
int count = 1;
while(cin >> n, n)
{
for(i = 0; i < n; i++)
cin >> a[i];
cout << "Game " << count++ << ":" << endl;
while(true)
{
A = B = 0;
for(i = 0; i < n; i++)
{
cin >> b[i];
if(a[i] == b[i])
A++;
}
if(b[0] == 0)
break;
for(i = 0; i < 10; i++)
{
int c1 = 0, c2 = 0;
for(j = 0; j < n; j++)
{
if(a[j] == i)
c1++;
if(b[j] == i)
c2++;
}
if(c1 < c2)
B += c1;
else
B += c2;
}
cout << " (" << A << ',' << B - A << ')' << endl;
}
}
return 0;
}