威佐夫博弈
$t=leftlfloor dfrac {left( 1+sqrt {5} ight) left( y-x ight) } {2} ight floor left( y>x ight)$
如果t=x则先手必败
否则先手必胜。
1 #include<iostream> 2 #include<cstdio> 3 #include<cmath> 4 using namespace std; 5 int x,y,t,qwq; 6 int main(){ 7 scanf("%d",&t); 8 while (t--){ 9 scanf("%d%d",&x,&y); 10 if (x>y) swap(x,y); 11 qwq=floor((1+sqrt(5))/2*(y-x)); 12 if (qwq==x) printf("Alphago "); 13 else printf("Amphetamine "); 14 } 15 return 0; 16 }
To be continue......