HDU 4287 Intelligent IME hash
来源:互联网 发布:影子网络怎么进入 编辑:程序博客网 时间:2024/04/30 08:34
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4287
题意:用9宫格敲了N次,给m个字符串,问你每次敲击,能够敲出多少个单词
解法:Hash或者map模拟一下,水题
//HDU 4287#include <bits/stdc++.h>using namespace std;map <int, int> mp1;string s[5010];map <string, int> mp2;int ans[5010];int main(){ int k = 2; for(int i = 0; i < 26; i++){ if(i==3||i==6||i==9||i==12||i==15||i==19||i==22) k++; mp1[i]=k; } int t, n, m; scanf("%d", &t); while(t--){ mp2.clear(); memset(ans, 0, sizeof(ans)); scanf("%d%d", &n, &m); for(int i = 0; i < n; i++) cin >> s[i]; string s1; for(int i = 0; i < m; i++){ cin >> s1; for(int j = 0; j < (int)s1.size(); j++){ s1[j] = char(mp1[(s1[j]-'a')]+'0'); } //cout << s1 << endl; mp2[s1]++; } for(int i = 0; i < n; i++) printf("%d\n", mp2[s[i]]); } return 0;}
0 0
- HDU 4287 Intelligent IME hash
- Hdu 4287 Intelligent IME 字典树 Hash
- hdu 4287Intelligent IME(简单hash)
- 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
- Tensorflow的Protocol Buffers3编程(一)
- 根据SVN距给定时间之后提交的文件进行增量部署Java工具类
- 每天一个Linux命令(34):du命令
- 将DataTable转换成CSV文件
- Linux学习笔记——例说makefile 增加宏定义
- HDU 4287 Intelligent IME hash
- Android并发编程之图文解析volatile关键字
- ConstraintLayout使用浅谈
- leetcode 93. Restore IP Addresses
- Android Dialog总结
- QT学习链接
- 写的一个Arduino控制超声波模块的例子
- javascriptAPI-高德地图(点击选地址)
- C#枚举类型的常用操作总结