Codeforces 689A. Mike and Cellphone(模拟)
来源:互联网 发布:吉诺比利职业生涯数据 编辑:程序博客网 时间:2024/06/06 00:50
题目链接
简单题意
给出在手机键盘上的操作路径(按键顺序),问这个操作路径是否唯一,能否平移得到另一种按键顺序。
思路
模拟就好了,但是要注意,因为0的那一列有四个数,要小心处理,最后就是栽在这上面了。
代码
#include <iostream>using namespace std;int num[15] = {0};int main(){ int n; cin >>n; string str; cin >> str; bool f = false,f1 = false,f2 = false; for(int i = 0 ; i < n ; i ++){ num[str[i] - '0'] = 1; } if((num[1] || num[2] || num[3]) && num[0]) f = true; if((num[1] || num[2] || num[3]) && (num[7] || num[9])) f1 = true; if((num[1] || num[4] || num[7]) && (num[3] || num[6] ||num[9])) f2 = true; if((f1&&f2) || f) cout << "YES" <<endl; else cout << "NO" <<endl;}
0 0
- codeforces 689A Mike and Cellphone(模拟)
- Codeforces 689A. Mike and Cellphone(模拟)
- CodeForces 689A Mike and Cellphone
- Codeforces-689A-Mike and Cellphone
- Codeforces Round #361 (Div. 2) A. Mike and Cellphone ( 模拟 )
- 【打CF,学算法——二星级】CodeForces 689A Mike and Cellphone (模拟)
- Codeforces Round #361 (Div. 2) 689A Mike and Cellphone
- CodeForces 689A Mike and Cellphone(拨号的唯一性)
- Codeforces Round #361 (Div. 2) A. Mike and Cellphone
- Codeforces Round #361 (Div. 2) A. Mike and Cellphone
- Codeforces Round #361 (Div. 2) A. Mike and Cellphone
- Codeforces Round #361 (Div. 2)A. Mike and Cellphone
- Codeforces Round #361 (Div.2) - A. Mike and Cellphone
- Codeforces Round #361 (Div. 2) -- A. Mike and Cellphone (思路题目)
- 689 A. Mike and Cellphone 条件判断题
- A. Mike and Cellphone(cf#361)
- Mike and Cellphone
- Mike and Cellphone
- 百度地图sdk无法定位错误总结
- RTF文件格式分析
- OrCAD:添加footprint属性图文教程
- yum 安装时错误 Errno 14 Couldn't resolve host 解决办法
- Android照片墙完整版,完美结合LruCache和DiskLruCache
- Codeforces 689A. Mike and Cellphone(模拟)
- Fragment抛出java.lang.IllegalStateException: Fragment not attached to Activity
- 算法日记(Java实现)第20160715(1)期——POJ1001/POJ1002
- Dependencies for Windows + Android
- JAVA Servlet
- dynamic - How to angular 2 dynamic tabs with user click chosen components
- 通过 PS 指令获得指定进程名称的 PID
- 百度地图的注意事项
- RTF文件结构分析及其应用