URAL 1877. Bicycle Codes
来源:互联网 发布:山东网络电视台 编辑:程序博客网 时间:2024/05/17 08:04
1877. Bicycle Codes
Time limit: 0.5 second
Memory limit: 64 MB
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
00010000
no
00020001
yes
还是水题,看明白题意就很好做了。
大致意思就是一个人有两把锁,设定两个不会换的密码,交替使用。一个小偷从0000开始每天+1来猜密码,最后判断他能否打开锁。
判断两把锁密码的奇偶性就好啦~
#include<cstdio>#include<iostream>using namespace std;int main(){ int a,b; while(cin>>a>>b) { if(a%2==0||b%2==1) cout<<"yes"<<endl; else cout<<"no"<<endl; } return 0;}
0 0
- URAL 1877. Bicycle Codes
- URAL 1877 Bicycle Codes
- URAL 1877Bicycle Codes 水题
- Bicycle
- Bicycle Race
- Bicycle Race
- Bicycle Race
- codes
- codes
- codes
- A. Bicycle Chain
- URAL
- 【ural】
- URAL
- URAL
- URAL
- URAL
- URAL
- OpenGL的SWT的控件
- 阿里巴巴电话面试
- ClipboardHelper
- Android去除标题栏、全屏
- hdu 1698 just a hook
- URAL 1877. Bicycle Codes
- poj 1061 青蛙的约会 【扩展欧几里得】
- keil+stm32+jlink利用swd方式进行printf输出
- 对象成员
- 初学c++引用计数器
- 寒假感想
- 当我真正理解了扩展欧几里得定理
- Java虚拟机性能管理神器 - VisualVM(3) 插件安装与更新路径配置
- UINavigationController 的生命周期