讲真,第一遍读下来不知道在讲个什么东西
大致就是有一个二人的game,一个designer和一个player,player可以guess很多次,每guess一次designer会给一个hint,任务就是要你输出每一次的hint
好吧,至于题目给了两个matches的independent的定义,以及一个集合independent的定义,这里我没怎么看懂
关键的句就是input的上面那一段的第二行“The hint then consists of the number of strong followedby the number of weak matches in M.”
这不就出来了么,hint是有strong和weak matches组成的,strong和weak的定义上面写的很清楚,以及strong强于weak
一看样例全都懂了
(第一次说话夹这么多洋字,hhhhhhhhhh。这一次分析题目有一种高中阅读理解的感觉,hhhhhhhh)
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int n,arr[1010],guess[1010],te,a,b,ca,origin[10],corigin[10],gue[10];
int main(){
ios_base::sync_with_stdio(false);
while(cin>>n&&n){
cout<<"Game "<<++ca<<":\n";
for(int i=0;i<n;++i)
cin>>arr[i],origin[arr[i]]++;
while(true){
for(int i=0;i<n;++i)
cin>>guess[i],te+=guess[i],++gue[guess[i]];
if(!te)break;
for(int i=0;i<10;++i)
corigin[i]=origin[i];
for(int i=0;i<n;++i)
if(arr[i]==guess[i])
++a,--corigin[arr[i]],--gue[arr[i]];
for(int i=0;i<10;++i)
b+=min(corigin[i],gue[i]);
cout<<" ("<<a<<','<<b<<")\n";
memset(gue,0,sizeof gue);
a=b=te=0;
}
memset(origin,0,sizeof origin);
memset(gue,0,sizeof gue);
}
return 0;
}