/// Raihan Ruhin /// CSE, Jahangirnagar University. /// Dhaka-Bangladesh. /// id: raihanruhin (topcoder / codeforces / codechef / hackerrank / uva / uvalive / spoj), 3235 (lightoj) /// mail: raihanruhin@ (yahoo / gmail / facebook) /// blog: ruhinraihan.blogspot.com //#include<bits/stdc++.h> #include<iostream> 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 func(long long a, long long b) { if(b==0) return 0; int ret=0; if(a/b > 1) ret = ret | !func(b+a%b, b); ret = ret | !func(b, a%b); //ret = ret ^ 1; return ret; } int main() { //ios_base::sync_with_stdio(0);cin.tie(0); long long n, tc, kk=1, a, b; string s; while(cin>>a>>b) { if(a==0 && b==0) return 0; if(a<b) swap(a, b); int res = func(a, b); if(res) cout<<"Stan wins\n"; else cout<<"Ollie wins\n"; } return 0; }
Tuesday, 31 March 2015
UVA 10368 Euclid's Game (ZOJ 1913, HDU 1525, POJ 2348)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment