天天看點

博弈-NYOJ-題目23取石子

奇異局勢

n+1

每個人面對 1~n都會勝利,那麼隻要給對手構造n+1的局勢必勝

是以m%(n+1)==0,則必敗

#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int m,n;
        cin>>n>>m;
        if(n%(m+1)==0)
            cout<<"Lose"<<endl;
        else
            cout<<"Win"<<endl;
    }
    return 0;
}