又是一道博弈论:题解:
https://www.luogu.org/blog/DJCreeper/p1290-ti-xie
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #include<iostream> #include<algorithm> using namespace std; void Stan(int,int); void Ollie(int,int); void Stan(int i,int j){ if(i==j||i/j>=2)cout<<"Stan wins"<<endl; else Ollie(max(i-j,j),min(i-j,j)); } void Ollie(int i,int j){ if(i==j||i/j>=2)cout<<"Ollie wins"<<endl; else Stan(max(i-j,j),min(i-j,j)); } int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ int v1,v2; cin>>v1>>v2; if(v1<v2)swap(v1,v2); Stan(v1,v2); } } |