题意:
给一个
n(n≤4294967295)
,每次从1开始轮流乘
2
~
题解:
好像大家都是用的不太严谨的做法。。
因为层数是
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<map>
typedef long long ll;
using namespace std;
const int N=1e3+50;
map<ll,int>SG;
inline ll rd(){
char ch=getchar();int i=0,f=1;
while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
while(isdigit(ch)){i=(i<<1)+(i<<3)+ch-'0';ch=getchar();}
return i*f;
}
ll n;
inline bool sg(ll x){
if(x>=n)return 0;
if(SG.find(x)!=SG.end())return SG[x];
for(int j=2;j<=9;j++){
if(!sg(x*j))return SG[x]=1;
}
return SG[x]=0;
}
int main(){
while(scanf("%d",&n)!=EOF){
SG.clear();
puts(sg(1)?"Stan wins.":"Ollie wins.");
}
}