[cpp]
/**本題的意思是,對應相等的為強,不對應相等的為弱,
* 我的做法是每次比較時復制一個目標串,把他和輸入的
*串對比,統計對應相等的,然後把值賦為-1,然後再統計不
*對應相等的
*/
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main(int argc, char const *argv[])
{
int cas, strong, week, *arr, *cmp, t, *arr1, n(0);
while(scanf("%d",&cas),cas){
printf("Game %d:\n", ++n);
arr = new int[cas+1]; cmp = new int[cas+1]; arr1 = new int[cas+1];
for(int i=0; i<cas; i++){
scanf("%d",&arr[i]);
}
while(true){
t = 0, strong = 0, week = 0;
for(int i=0; i<cas; i++){
scanf("%d",&cmp[i]);
arr1[i] = arr[i];
}
if(cmp[0]==0) break;
for(int i=0; i<cas; i++){
if(arr1[i]==cmp[i]){
strong++;
cmp[i]=-1; arr1[i] = -1;
} www.2cto.com
}
for(int i=0; i<cas; i++){
for(int j=0; j<cas; j++){
if(arr1[i]==cmp[j] && arr1[i]!=-1){
week++; cmp[j] = -1;
break;
}
}
}
printf(" (%d,%d)\n",strong, week);
}
}
return 0;
}