UVA-489
程序员文章站
2022-03-14 19:39:50
...
#include<iostream>
#include<cstring>
using namespace std;
int a,tmp1,tmp2,tmp3,ans,bol;bool j[500];
int main()
{
string str,ges;
while(1)
{
cin>>a;
if(a==-1)
return 0;
cout<<"Round"<<' '<<a<<endl;
cin>>str;cin>>ges;
for(int i=0;i<str.size();i++)
{
if(!j[str[i]]){
j[str[i]]=1;
tmp1++;
}
}
for(int i=0;i<ges.size();i++)
{
if(j[ges[i]])
{
j[ges[i]]=0;tmp2++;
if(tmp2==tmp1)
break;
}
else
tmp3++;
if(tmp3==7){
bol=1;
break;
}
}
if(bol==1)
cout<<"You lose."<<endl;
else{
if(tmp2==tmp1)
cout<<"You win."<<endl;
else
cout<<"You chickened out."<<endl;
}
tmp1=tmp2=tmp3=bol=0;
memset(j,0,sizeof(j));
}
return 0;
}
推荐阅读