/// Raihan Ruhin /// CSE, Jahangirnagar University. /// Dhaka-Bangladesh. /// id: raihanruhin (topcoder / codeforces / codechef / uva / uvalive / spoj), 3235 (lightoj) /// mail: raihanruhin@ (yahoo / gmail / facebook) /// blog: ruhinraihan.blogspot.com #include<bits/stdc++.h> using namespace std; #define SET(a) memset(a,-1,sizeof(a)) #define CLR(a) memset(a,0,sizeof(a)) #define PI acos(-1.0) #define MOD 1000000007 #define MX 100010 int main() { ios_base::sync_with_stdio(0);cin.tie(0); int tc, kk=1, n; string s; char ch; while(cin>>s && s!="#") { int cnt=0; for(int i=0;i<s.length()-1;i++) { cout<<s[i]; if(s[i]=='1') cnt++; } if((s[s.length()-1]=='e' && cnt%2) || (s[s.length()-1]=='o' && cnt%2==0) ) cout<<"1\n"; else cout<<"0\n"; } return 0; }
Friday, 2 October 2015
Parity (UVALive 4167, HDU - 2700, Regionals 2008 >> North America - Mid-Central USA)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment