URAL 1877 Bicycle Codes

Bicycle Codes

Time limit: 0.5 second
Memory limit: 64 MB
Den has two four-digit combination locks for protecting his bicycle from thieves. Every evening he arms the bicycle antitheft alarm and fastens the bicycle to a special stand with one of the locks. Den never uses the same lock two evenings in a row. One night a thief tried to open the lock using the code 0000. The alarm went off and the thief hurried away. The next night the thief decided to try the code 0001, then 0002, and so on in ascending order of the number.
Den never changes the codes of his locks. On the night when the thief came for the first time the bicycle was fastened with the first lock.

Input

The first line contains the combination that opens the first lock and the second line contains the combination that opens the second lock. Both combinations are strings consisting of four digits from 0 to 9.

Output

Output “yes” if the thief will open the lock sooner or later and “no” otherwise.

Samples

input output
0001
0000
no
0002
0001
yes




题意:一人有两把锁,每天换一把,交替使用。小偷从0000开始试,每天加一。

解析:奇偶判断。



AC代码:

#include <cstdio>

int main(){
    int a, b;
    while(scanf("%d%d", &a, &b)==2){
        if(a % 2 == 0 || b & 1) puts("yes");
        else puts("no");
    }
    return 0;
}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值