hdu 4287 Intelligent IME
来源:互联网 发布:sql 逐行累加 编辑:程序博客网 时间:2024/05/15 06:08
题意:告诉你手机键盘上数字对应的字母,然后给你一些数字串和一些字母串,问你有几个字母串对应相应的数字串。
解法:map,先手机键盘建立一个map,然后数字串和对应的编号建立一个map;
#include<bits/stdc++.h>using namespace std;int main(){ map<char,char>pq; map<string,int>qp; pq['a']='2'; pq['b']='2'; pq['c']='2'; pq['d']='3'; pq['e']='3'; pq['f']='3'; pq['g']='4'; pq['h']='4'; pq['i']='4'; pq['j']='5'; pq['k']='5'; pq['l']='5'; pq['m']='6'; pq['n']='6'; pq['o']='6'; pq['p']='7'; pq['q']='7'; pq['r']='7'; pq['s']='7'; pq['t']='8'; pq['u']='8'; pq['v']='8'; pq['w']='9'; pq['x']='9'; pq['y']='9'; pq['z']='9'; int T; cin>>T; while(T--) { int n,m,c[5010]={0}; string a[5010],b[5010],str; cin>>n>>m; for(int i=0;i<n;i++) { cin>>a[i]; qp[a[i]]=i; } for(int i=0;i<m;i++) { cin>>b[i]; int len=b[i].size(); str=""; for(int j=0;j<len;j++) str+=pq[b[i][j]]; if(qp.count(str)!=0) c[qp[str]]++; } for(int i=0;i<n;i++) printf("%d\n",c[i]); } return 0;}
0 0
- hdu 4287 Intelligent IME
- HDU-4287-Intelligent IME
- HDU 4287 Intelligent IME
- hdu 4287 Intelligent IME
- Intelligent IME hdu 4287
- HDU 4287 Intelligent IME
- HDU 4287 Intelligent IME
- HDU 4287 Intelligent IME
- hdu-4287 Intelligent IME
- hdu 4287 Intelligent IME
- HDU 4287 - Intelligent IME
- HDU 4287 Intelligent IME
- HDU 4287 Intelligent IME
- hdu 4287 Intelligent IME
- hdu 4287 Intelligent IME
- hdu-4287 Intelligent IME
- hdu 4287 Intelligent IME
- HDU 4287 Intelligent IME
- 矩阵基础1005 HDU 4686
- 【Maven用户手册】Maven命令
- 双守护进程保护程序运行
- php联想搜索
- 【Maven用户手册】Maven仓库
- hdu 4287 Intelligent IME
- mysql 的基本命令
- all_of 源码剖析
- ContextLoaderListener作用详解
- plsql连接oracle问题
- java之集合类详解
- light oj 1257 Farthest Nodes in a Tree (II)(724训练题目)主要是利用了反证法: 假设 s-t这条路径为树的直径,或者称为树上的最长路 现有结论,从任意一点
- 【Maven用户手册】Maven之setting.xml配置文件详解
- 简单的HTML学习