codeforces April Fools Day Contest 2014, problem: (A) The Great Game editorial: http://codeforces.com/blog/entry/11391
codeforces April Fools Day Contest 2014, problem: (A) The Great Game solution: http://ideone.com/uDfRvY
#include <iostream> #include <cstdio> #include <cstring> using namespace std; int main() { int a[100], b[100], t1, t2; char s1[100], s2[100]; for(int i=0; i<100; i++) a[i]=b[i]=0; t1=t2=0; scanf("%s%s", s1, s2); for(int i=0, j=0; i<strlen(s1); i+=2, j++) { if(s1[i]=='8') a[j]=1; else if(s1[i]=='[') a[j]=2; else a[j]=3; } for(int i=0, j=0; i<strlen(s2); i+=2, j++) { if(s2[i]=='8') b[j]=1; else if(s2[i]=='[') b[j]=2; else b[j]=3; } for(int i=0; i<100; i++) { if((a[i]==1 && b[i]==2) || (a[i]==2 && b[i]==3) || (a[i]==3 && b[i]==1)) t1++; else if((b[i]==1 && a[i]==2) || (b[i]==2 && a[i]==3) || (b[i]==3 && a[i]==1)) t2++; } if(t1>t2) printf("TEAM 1 WINS"); else if(t1==t2) printf("TIE"); else printf("TEAM 2 WINS"); return 0; }
No comments:
Post a Comment