From Evernote: |
uva 489 |
這題只能說無庸置疑的屌測資
1
abcdef
aghijklmcdefb
2
abcdef
abcdklmnoegfi
3
abcdef
abcklmnopdf
在此公布給大家
[sourcecode language="cpp"]
//============================================================================
// Name : Hangman Judge.cpp
// Date : 2013 2013/3/6 上午12:34:22
// Author : GCA
//============================================================================
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cctype>
#include <utility>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
#define Set(a,s) memset(a,s,sizeof(a))
#define Write(w) freopen(w,"w",stdout)
#define Read(r) freopen(r,"r",stdin)
#define Pln() printf("\n")
#define I_de(x,n)for(int i=0;i<n;i++)printf("%d ",x[i]);Pln()
#define De(x)printf(#x"%d\n",x)
#define For(i,x)for(int i=0;i<x;i++)
#define CON(x,y) x##y
#define Pmz(dp,nx,ny)for(int hty=0;hty<ny;hty++){for(int htx=0;htx<nx;htx++){\
printf("%d ",dp[htx][hty]);}Pln();}
#define M 100005
#define PII pair<int,int>
#define PB push_back
#define oo INT_MAX
#define Set_oo 0x3f
#define Is_debug true
#define debug(...) if(Is_debug)printf("DEBUG: "),printf(__VA_ARGS__)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define eps 1e-6
bool xdy(double x,double y){return x>y+eps;}
bool xddy(double x,double y){return x>y-eps;}
bool xcy(double x,double y){return x<y-eps;}
bool xcdy(double x,double y){return x<y+eps;}
int min3(int x,int y,int z){
int tmp=min(x,y);
return min(tmp,z);
}
int max3(int x,int y,int z){
int tmp=max(x,y);
return max(tmp,z);
}
int m[1000],m2[1000];
int main() {
ios_base::sync_with_stdio(0);
int round;
while(~scanf("%d",&round)&&round!=-1){
Set(m,0);
Set(m2,0);
char str[1000],str2[1000];
scanf("%s %s",str,str2);
int len=strlen(str);
int len2=strlen(str2);
for(int i=0;i<len;i++){
m[str[i]]=1;
}
for(int i=0;i<len2;i++)
m2[str2[i]]=1;
int state=1,fg=0;
for(int i=0;i<len2;i++){
if(m2[str2[i]]){
bool bfg=true;
for(int j=0;j<len;j++){
if(str2[i]==str[j]){
m[str[j]]=0;
bfg=false;
}
}
if(bfg)fg++;
if(fg>=7)state=2;
else{
bool solving=true;
for(int j=0;j<len;j++){
if(m[str[j]]){
solving=false;
break;
}
}
if(solving){
fg=-oo;
}
m2[str2[i]]=0;
}
}
}
if(fg>=7)state=2;
else state=0;
for(int i='A';i<='z';i++){
if(m[i]==1){
state=2;
break;
}
}
printf("Round %d\n",round);
if(fg>=7&&state==2)printf("You lose.\n");
else if(state==2)printf("You chickened out.\n");
else printf("You win.\n");
}
}
[/sourcecode]
留言
張貼留言