luogu_1290 欧几里德的游戏
#include <cstdio> #include <iostream> using namespace std; int t,n,m; int getsg(int x,int y){ if(x%y==0)return 1; if(x/y==1)return 1-getsg(y,x%y); else return 1; } int main(){ scanf("%d",&t); while(t--){ scanf("%d%d",&n,&m); if(n<m)swap(n,m); if(getsg(n,m))puts("Stan wins"); else puts("Ollie wins"); } return 0; }