Alice and Bob like playing games. There are two piles of stones with numbers {n}n and {m}m. Alice and Bob take turns to operate, each operation can take away {k}(k>0)k(k>0) stones from one pile and take away s \times k(s \geq 0)s×k(s≥0) stones from another pile. Alice plays first. The person who cannot perform the operation loses the game.
Please determine who will win the game if both Alice and Bob play the game optimally.
输入描述:
The first line contains an integer T(1 \le T \le 10^4)T(1≤T≤10
4
) denotes the total number of test cases.
Each test case contains two integers n,m(1 \le n,m \leq 5 \times 10^3)n,m(1≤n,m≤5×10
3
) in a line, indicating the number of two piles of stones.
输出描述:
For each test case, print "Alice" if Alice will win the game, otherwise print "Bob".
示例1
输入
5
2 3
3 5
5 7
7 5
7 7
```c
include<stdio.h>
int main()
{
//ios::sync_with_stdio(false);cin.tie(0);
int a[5000][2]={{2,3},{5,7},{9,12},{14,18},{20,25},{27,33},{35,42},{44,52},{54,63},{65,75},{77,88},{90,102},{104,117},{119,133},{135,150},{152,168},{170,187},{189,207},{209,228},{230,250},{252,273},{275,297},{299,322},{324,348},{350,375},{377,403},{405,432},{434,462},{464,493},{495,525},{527,558},{560,592},{594,627},{629,663},{665,700},{702,738},{740,777},{779,817},{819,858},{860,900},{902,943},{945,987},{989,1032},{1034,1078},{1080,1125},{1127,1173},{1175,1222},{1224,1272},{1274,1323},{1325,1375},{1377,1428},{1430,1482},{1484,1537},{1539,1593},{1595,1650},{1652,1708},{1710,1767},{1769,1827},{1829,1888},{1890,1950},{1952,2013},{2015,2077},{2079,2142},{2144,2208},{2210,2275},{2277,2343},{2345,2412},{2414,2482},{2484,2553},{2555,2625},{2627,2698},{2700,2772},{2774,2847},{2849,2923},{2925,3000},{3002,3078},{3080,3157},{3159,3237},{3239,3318},{3320,3400},{3402,3483},{3485,3567},{3569,3652},{3654,3738},{3740,3825},{3827,3913},{3915,4002},{4004,4092},{4094,4183},{4185,4275},{4277,4368},{4370,4462},{4464,4557},{4559,4653},{4655,4750},{4752,4848},{4850,4947}};
//共97项
int N;
int m,n;
scanf("%d",&N);
int i;
char flag;
while(N--)
{
flag='A';
scanf("%d%d",&m,&n);
for(i=0;i<97;i++)
{
if((a[i][0]==m&&a[i][1]==n)||(a[i][0]==n&&a[i][1]==m))
{
flag='B';
continue;
}
}
if(flag=='A') printf("Alice\n");
else if(flag=='B') printf("Bob\n");
//else printf("ERROR");
}
return 0;
}
```#