HDU 4287 Intelligent IME 水题
来源:互联网 发布:局域网网络硬盘软件 编辑:程序博客网 时间:2024/06/16 15:44
本想写个字典树
结果发现是个水题。。
#include <iostream>#include <cstdio>#include <cmath>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int MAX = 1000000 + 5;int num[MAX], val[MAX];const int mp[] = {2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9};int map(char *str) { int len = strlen(str), ans = 0; for(int i = 0; i < len; i++) { ans *= 10; ans += mp[str[i] - 'a']; } return ans;}int main() { int t, n, m; char str[10]; scanf("%d", &t); while(t--) { scanf("%d%d", &n, &m); memset(num, 0, sizeof(num)); for(int i = 0; i < n; i++) scanf("%d", val + i); while(m --) { scanf("%s", str); num[map(str)]++; } for(int i = 0; i < n; i++) printf("%d\n", num[val[i]]); } return 0;}
0 0
- HDU 4287 Intelligent IME 水题
- 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
- 9.5 VS2010中调试c++程序的方法
- NFC的安卓事儿(第五篇)
- 几种排序
- [Hadoop源码解读](四)MapReduce篇之Counter相关类 (转)
- C++二维数组new几种应用方法点评
- HDU 4287 Intelligent IME 水题
- MySQL SQL优化:关联子查询的局限性
- 使用 Boost 的 IPC 和 MPI 库进行并发编程
- Notes of Inline Assembly
- 谈谈自已对dbcp连接池的认识
- Unity3d NGUI的使用(九)(UIScrollView制作滑动列表)
- 005_009 Python 在排序已经完成的序列中查找元素
- Qt使用QGraphicsView实现滑动窗体效果
- HTML5脚本编程