/*
* Copyright (c) 2017, 安徽大学计算机科学与技术学院
* All rights reserved.
* 作 者: 杨磊
* 完成日期:2017 年 01 月 07 日
* 刘汝佳的代码,照搬一遍。简洁高效,Orz。
*/
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<stdlib.h>
using namespace std;
#define maxn 105
char s[maxn],s2[maxn];
int win,lose;
int len,chance;
void guess(char ch){
int bad=1;
for(int i=0;i<strlen(s);i++)
if(s[i]==ch){
len--;
s[i]=' ';
bad=0;
}
if(bad) --chance;
if(!chance) lose=1;
if(!len) win=1;
}
int main(){
int rnd;
while(scanf("%d%s%s",&rnd,s,s2)==3&&rnd!=-1){
printf("Round %d\n",rnd);
win=lose=0;
len=strlen(s);
chance=7;
for(int i=0;i<strlen(s2);i++){
guess(s2[i]);
if(win||lose)
break;
}
if(win)
printf("You win.\n");
else if(lose)
printf("You lose.\n");
else
printf("You chickened out.\n");
}
return 0;}
UVA489
最新推荐文章于 2021-07-21 13:43:53 发布