2021牛客暑期多校训练营第一场

链接:https://ac.nowcoder.com/acm/contest/11166/A
来源:牛客网
(这是A题,其他的题目在我博客也有的)

打表:

using namespace std;
#define P pair<int,int>
const int N=5e3+100;
bitset<N>a[N];
int main()
{
    for(int i=0;i<=5000;i++)
    {
        for(int j=0;j<=5000;j++)
        {
            if(!a[i][j])
            {
                for(int t=1;t+i<=5000;t++)
                {
                    for(int k=0;j+t*k<=5000;k++)
                    {
                        a[i+t][j+t*k]=1;
                    }
                }
                for(int t=1;t+j<=5000;t++)
                {
                    for(int k=0;i+t*k<=5000;k++)
                    {
                        a[i+t*k][j+t]=1;
                    }
                }
            }
        }
    }
    int t;
    cin>>t;
    int n,m;
    while(t--)
    {
        cin>>n>>m;
        puts(a[n][m]?"Alice":"Bob");
    }
}
原文地址:https://www.cnblogs.com/GUOGaby/p/15027683.html