codeforces 361 A - Mike and Cellphone
2016-07-12 20:30
399 查看
题目链接:http://codeforces.com/contest/689/problem/ADescriptionWhile swimming at the beach, Mike has accidentally dropped his cellphone into the water. There was no worry as he bought a cheap replacement phone with an old-fashioned keyboard. The keyboard has only ten digital equal-sized keys, located in the following way:
#include<iostream> #include<cstdio> using namespace std; char a[12]; int n; int xx() { int a1,b,c,d; a1=1; b=1; c=1; d=1; for(int i=0; i<n; i++) { if(a[i]=='1'||a[i]=='4'||a[i]=='7'||a[i]=='0') a1=0; if(a[i]=='3'||a[i]=='6'||a[i]=='9'||a[i]=='0') b=0; if(a[i]=='1'||a[i]=='2'||a[i]=='3') c=0; if(a[i]=='7'||a[i]=='9'||a[i]=='0') d=0; } if(a1||b||c||d) return 0; else return 1; } int main() { while(cin>>n) { cin>>a; if(xx()) cout<<"YES"<<endl; else cout<<"NO"<<endl; } }View Code
相关文章推荐
- 安卓Design包之TabLayout控件的简单使用
- IOS进阶 - CALayer的子类
- Linux下*.tar.gz文件解压缩命令
- PHP5调用win系统com组件
- SharedPreferences基本使用
- 高精度模板
- 线程URL访问网络资源
- LeetCode 第 367 题 (Valid Perfect Square)
- java基础学习篇之核心java
- LeetCode 第 367 题 (Valid Perfect Square)
- 完美的.net泛型也有特定的性能黑点?追根问底并且改善这个性能问题
- UVA 12295 Optimal Symmetric Paths 最短路求方案数
- 获取系统时间
- XMind错误
- 操作系统读书笔记(3)
- Eclipse快捷键以及Layout布局异常
- 直角三角形 纪中 1385 数学_斜率 英文题解
- SpringMVC+Spring搭建web工程环境
- AbstractQueuedSynchronizer(五)——方法比较
- Java多线程中Sleep与Wait的区别