标签:
1 #include<iostream> 2 #include<stdio.h> 3 using namespace std; 4 5 int main() 6 { 7 //freopen("acm.acm","r",stdin); 8 unsigned num; 9 unsigned mod; 10 unsigned begin; 11 unsigned end; 12 int i; 13 i = 0; 14 while(cin>>num) 15 { 16 begin = 1; 17 end = 1; 18 if(num >= 1 && num <= 9) 19 { 20 cout<<"Stan wins."<<endl; 21 continue; 22 } 23 for(i = 0; i < num; ++ i) 24 { 25 begin *= 9; 26 end = begin*2; 27 if(num >= begin+1 && num <= end) 28 { 29 cout<<"Ollie wins."<<endl; 30 break; 31 } 32 begin = end; 33 end = begin*9; 34 if(num >= begin+1 && num <= end) 35 { 36 cout<<"Stan wins."<<endl; 37 break; 38 } 39 40 } 41 } 42 } 43 /* 44 1 ----- 9 先胜 45 9+1 ------ 9*2 先负 46 9*2+1 ---- 9*2*9 先胜 47 9*2*9+1 ---- 9*2*9*2 先负 48 */
标签:
原文地址:http://www.cnblogs.com/gavinsp/p/4568470.html