CF1719A Chip Game

 题意简述:

现有 $n*m$ 个方格,$Burenka$ 先手, $Tonya$ 后手进行博弈

棋子在 $ (1 , 1) $

规则:每回合可以将棋子向上或向右移动奇数个单位.

胜负判断:不能移动棋子的选手输掉比赛.

输出胜者.

 分析:

一道博弈论的签到题 , 由于对移动进行了限制 , 所以我们从这方面入手 , 只需判断 $n,m$ 的奇偶性.

 代码:

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
#include<set>
#include<stack>
#include<map>
#include<queue>
#include<cstdlib>
#include<iomanip>
#include<utility>
#define mid (l+r>>1)
#define endl '\n'
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pai;
const double eps = 1e-10;
const int base = 13331;
const long long mod = 998242353;
long long maxn = -2147483647-1,minn = 0x7f7f7f7f;
ll t,n,m;
int main(){
    //freopen("filename.in","r",stdin);
    //freopen("filename.out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    cin>>t;
    while(t--){
        cin>>n>>m;
        if(n%2!=m%2){
            cout<<"Burenka"<<endl;
        }
        else{
            cout<<"Tonya"<<endl;
        }
    }
    //fclose(stdin);
    //fclose(stdout);
    return 0;
}

 

总结:

签到题 , 看样例出解法.

posted @ 2022-08-17 14:17  风絮烟雨  阅读(14)  评论(0)    收藏  举报