1. 程式人生 > 其它 >2021牛客暑期多校訓練營第一場

2021牛客暑期多校訓練營第一場

連結:https://ac.nowcoder.com/acm/contest/11166/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");
    }
}
*我是GUOdx CS與人文的愛好者 有時候在這寫寫部落格 最喜歡的一句話是:"生活在碎片時代 不能像碎片一樣生活"~