Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- bool can_win(ll n,ll p)
- {
- if(p * 9 < n && p * 18 >= n)
- return false;
- for(ll i=2; i<=9; i++)
- {
- if(can_win(n,p*i)==false)
- return true;
- }
- return false;
- }
- int main()
- {
- ll n;
- while(cin>>n)
- {
- if (n == 1)
- puts("Ollie wins.");
- else if (n >= 2 && n <= 9)
- puts ("Stan wins.");
- else
- {
- bool c= can_win(n,1);
- if(c)
- printf("Stan wins.\n");
- else
- printf("Ollie wins.\n");
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement