Description We all use cell phone today. And we must be familiar with the intelligent English input method on the cell phone. To be specific, the number buttons may correspond to some English letters respectively, as shown below: 2 : a, b, c    3 : d…
转载请注明出处:http://blog.csdn.net/u012860063 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4287 Intelligent IME Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2091    Accepted Submission(s): 1031…
Intelligent IME Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4776    Accepted Submission(s): 2227 Problem Description We all use cell phone today. And we must be familiar with the intelligen…
在我没用hash之前,一直TLE,字符串处理时间过长,用了hash之后一直CE,(请看下图)我自从经历我的字典树G++MLE,C++AC以后,一直天真的用C++,后来的CE就是因为这个,G++才支持这个hash... #include<cstdio>#include<iostream> #include<string.h> ]; struct TrieNode { int no; TrieNode *next[]; } node[]; TrieNode *root =…
Intelligent IME Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4287 Description We all use cell phone today. And we must be familiar with the intelligent English input method on the cell phone. To be specific,…
Intelligent IME Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1348    Accepted Submission(s): 685 Problem Description We all use cell phone today. And we must be familiar with the intelligent…
题目 转载来的,有些stl和string的函数蛮好的: //numx[i]=string(sx); //把char[]类型转换成string类型 // mat.insert(make_pair(numx[i],0)); //创造一个(string,int)整体——结构体,插入map //sx[j]=ch[sx[j]-'a'];//把字母转换成相应的数字 //mat.find(numx[i])->second;//返回位置—— 取map当中num[i]对应的键值 #include<cstdio&…
// hdu 1671 Phone List 字典树 // // 题目大意: // // 有一些电话号码的字符串长度最多是10,问是否存在字符串是其它字符串的前缀 // // // 解题思路: // // 字典树,先插入第一个字符串,然后依照查询,插入的方式进行訪问,发现了之后 // 就不用再进行字典树的操作了 // // // 感悟: // // 题目意思非常清楚,我在细节方面思考了非常久,插入方面在每一个串的根节点的时候加 // 上一个val值标记.查询的时候先看是否有标记,有则直接返回tr…
/******************************************************* 题目: 统计难题 (hdu 1251) 链接: http://acm.hdu.edu.cn/showproblem.php?pid=1251 算法: 字典树 提示: 这题压要用c++提交,G++会超内存 *******************************************************/ #include<cstdio> #include<cstr…
Chip Factory Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5536 Description John is a manager of a CPU chip factory, the factory produces lots of chips everyday. To manage large amounts of products, every proc…