HDU 4287 Intelligent IME map的应用
来源:互联网 发布:帝国cms 模型 编辑:程序博客网 时间:2024/06/10 06:21
来源:http://acm.hdu.edu.cn/showproblem.php?pid=4287
题意:首先给你一些由数字组成的串,数字分别对应于手机键盘上的一些字母。然后给一些字符串,问每个字符串能对应几个上面出现过的数字串。
思路:用map可以解决。网络赛最简单的题了。
题意:首先给你一些由数字组成的串,数字分别对应于手机键盘上的一些字母。然后给一些字符串,问每个字符串能对应几个上面出现过的数字串。
思路:用map可以解决。网络赛最简单的题了。
代码:
#include <iostream>#include <cstdio>#include <string>#include <string.h>#include <map>using namespace std;const int N = 5010;char fun(char ch){ if(ch >= 'a' && ch <= 'c') return 2; else if(ch >= 'd' && ch <= 'f') return 3; else if(ch >= 'g' && ch <= 'i') return 4; else if(ch >= 'j' && ch <= 'l') return 5; else if(ch >= 'm' && ch <= 'o') return 6; else if(ch >= 'p' && ch <= 's') return 7; else if(ch >= 't' && ch <= 'v') return 8; else return 9;}int main(){ int numcase; scanf("%d",&numcase); while(numcase--){ int n,m; scanf("%d%d",&n,&m); string ss[N]; for(int i = 0; i < n; ++i) cin >> ss[i]; string idss; map<string,int> mp; while(m--){ cin >> idss; string newss; for(int i = 0; i < idss.size(); ++i){ newss += char(fun(idss[i]) + '0'); } mp[newss]++; } for(int i = 0; i < n; ++i) printf("%d\n",mp[ss[i]]); } return 0;}
- HDU 4287 Intelligent IME map的应用
- hdu 4287 Intelligent IME map的简单应用
- HDU 4287 Intelligent IME(STL 映射map的运用)
- HDU 4287 Intelligent IME(map运用)
- map-hdu 4287-Intelligent IME-想法题
- HDU 4287 Intelligent IME (字典树 && map)
- hdu 4287 Intelligent IME STL应用
- 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
- UVA 540 小团体队列
- 标准模板库STL简介
- oracle-如何连接到net数据库
- ZOJ 1847 The Trip
- 搜索引擎-查询
- HDU 4287 Intelligent IME map的应用
- struts2-下拉菜单的回显
- c++函数功能 引用 & 重载 & 默认参数 & 内联
- 【ASP.NET开发】ADO.NET调用带输出参数的存储过程
- C语言创建链表malloc的使用(C的创建对象)
- 七夕感怀
- (redhat/CentOS/Fedora)Linux下利用ISO包或者光盘进行yum安装
- 复习小记----第12章 类
- C语言之详解#ifdef等宏