[cpp]
/**本题的意思是,对应相等的为强,不对应相等的为弱,
* 我的做法是每次比较时复制一个目标串,把他和输入的
*串对比,统计对应相等的,然后把值赋为-1,然后再统计不
*对应相等的
*/
#include
#include
#include
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
}
while(true){
t = 0, strong = 0, week = 0;
for(int i=0; i
arr1[i] = arr[i];
}
if(cmp[0]==0) break;
for(int i=0; i
strong++;
cmp[i]=-1; arr1[i] = -1;
} www.2cto.com
}
for(int i=0; i
week++; cmp[j] = -1;
break;
}
}
}
printf(" (%d,%d)\n",strong, week);
}
}
return 0;
}