A. Eevee Http://codeforces.com/contest/452/problem/A
String water problem
1#include <cstdio>2#include <cstring>3 using namespacestd;4 Const intm= -;5 Chara[ -][m]={"Vaporeon","Jolteon","Flareon","Espeon","Umbreon","Leafeon","Glaceon","Sylveon"};6 CharB[m];7 intMain () {8 intN;9 while(~SCANF ("%d",&N)) {Tenscanf"%s", b); One for(intI=0;i<8; i++){ A intLa=strlen (A[i]); - if(la==N) { - BOOLflag=true; the for(intj=0; j<n;j++){ - if(b[j]!='.'&&b[j]!=A[i][j]) { -flag=false; - Break; + } - } + if(flag) { A puts (a[i]); at Break; - } - } - } - } - return 0; in}
View Code
B. 4-point polyline Http://codeforces.com/contest/452/problem/B
Some forms of violence
1#include <cstdio>2#include <cstdlib>3#include <cstring>4#include <cmath>5#include <cctype>6#include <iostream>7#include <algorithm>8#include <queue>9#include <stack>Ten#include <vector> One#include <map> A#include <Set> - #defineMT (A, b) memset (A,b,sizeof (a)) - using namespacestd; the typedef __int64 LL; - Const intinf=0x7fffffff; - Const intm= -; - structpoint{ + intx, y; - }; + structg{ APoint p[4]; at intVal; -FriendBOOL operator<(G a,g b) { - returnA.val>B.val; - } - }g[m]; - intDist (Point A,point b) { in return(a.x-b.x) * (a.x-b.x) + (A.Y-B.Y) * (a.y-b.y); - } to intLG; + voidAddintIdintXinty) { -g[lg].p[id].x=x; theg[lg].p[id].y=y; * } $ intMain () {Panax Notoginseng intn,m; - while(~SCANF ("%d%d",&n,&m)) { the if(n==0){ +printf"0 1\n"); Aprintf"0%d\n", m); theprintf"0 0\n"); +printf"0%d\n", M-1); - Continue; $ } $ if(m==0){ -printf"1 0\n"); -printf"%d 0\n", n); theprintf"0 0\n"); -printf"%d 0\n", N-1);Wuyi Continue; the } -lg=0; WuAdd0,0,0); -Add1, n,m); AboutAdd2,0, m); $Add3N0); -lg++; -Add0,0,0); -Add1, n,m); AAdd2N0); +Add3,0, m); thelg++; -Add0,1,0); $Add1, n,m); theAdd2,0,0); theAdd3, N-1, m); thelg++; theAdd0,0,1); -Add1, n,m); inAdd2,0,0); theAdd3, n,m-1); thelg++; AboutAdd0,1,1); theAdd1, n,m); theAdd2,0,0); theAdd3, N-1, M-1); +lg++; - for(intI=0; i<lg;i++){ theG[i].val=0;Bayi for(intj=0;j<3; j + +){ theG[i].val+=dist (g[i].p[j],g[i].p[j+1]); the } - } -Sort (g,g+LG); the for(intI=0;i<4; i++){ theprintf"%d%d\n", g[0].p[i].x,g[0].p[i].y); the } the } - return 0; the}
View Code