「CF452A」Eevee
You are solving the crossword problem K from IPSC 2014. You solved all the clues except for one: who does Eevee evolve into? You are not very into pokemons, but quick googling helped you find out, that Eevee can evolve into eight different pokemons: Vaporeon, Jolteon, Flareon, Espeon, Umbreon, Leafeon, Glaceon, and Sylveon.
You know the length of the word in the crossword, and you already know some letters. Designers of the crossword made sure that the answer is unambiguous, so you can assume that exactly one pokemon out of the 8 that Eevee evolves into fits the length and the letters given. Your task is to find it.
First line contains an integer n (6 ≤ n ≤ 8) – the length of the string.
Next line contains a string consisting of n characters, each of which is either a lower case english letter (indicating a known letter) or a dot character (indicating an empty cell in the crossword).
Print a name of the pokemon that Eevee can evolve into that matches the pattern in the input. Use lower case letters only to print the name (in particular, do not capitalize the first letter).
1 2 |
7 j...... |
1 |
jolteon |
1 2 |
7 ...feon |
1 |
leafeon |
1 2 |
7 .l.r.o. |
1 |
flareon |
Here’s a set of names in a form you can paste into your solution:
[“vaporeon”, “jolteon”, “flareon”, “espeon”, “umbreon”, “leafeon”, “glaceon”, “sylveon”]
{“vaporeon”, “jolteon”, “flareon”, “espeon”, “umbreon”, “leafeon”, “glaceon”, “sylveon”}
题解
蛋碎一地,模拟都模拟错了
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #define ll long long #define inf 1000000000 using namespace std; inline ll read() { int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } int n,tot; bool mark[8]; string s[8]={"vaporeon", "jolteon", "flareon", "espeon", "umbreon", "leafeon", "glaceon", "sylveon"}; char ch[10]; bool solve(int x) { for(int i=0;i<8;i++) { if(mark[i])continue; if(s[i][x]!=ch[x]) { mark[i]=1;tot++; if(tot==7)return 1; } } return 0; } int main() { n=read(); for(int i=0;i<8;i++) if((s[i].length())!=n) { mark[i]=1;tot++; } scanf("%s",ch); for(int i=0;i<n;i++) if(ch[i]!='.') { if(solve(i))break; } for(int i=0;i<8;i++) if(!mark[i])cout<<s[i]; return 0; } |