本以为是分治法 谁知道

This day, Xcx gets a bar of chocolate which can be divided into n*m rectangles. But the chocolate is bitten by Dby, one is the upper left corner while one is the lower right corner. So Xcx thinks if every time he eats a 1*2 rectangle on the last chocolate, can he eat the chocolate up?

  一块巧克力,可以看成n*m个1*1的小块,我也不知道为什么这样理解,左上角和右下角被各吃去一块1*1的,

问,每次吃1*2的矩形,能否吃完

 分析:本来以为是分治法,看着有点像棋盘覆盖,但是比赛的时候看他们都交的那么快,我就很不解,最后问同学才知道

只要n m一个奇数一个偶数就可以吃完,mmp这傻逼题,ORZ

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define maxn 1000006
#define ll long long
using namespace std;
int main()
{
    int a,b;
    while(scanf("%d%d",&a,&b)!=EOF){
        if(a%2==0&&b%2==0)
            printf("No\n");
        else if(a%2==1&&b%2==1)
            printf("No\n");
        else
            printf("Yes\n");
    }
    return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值