HDU 1880 魔咒词典
2013-06-30 16:24
344 查看
用两个map,一个用来存意思--魔咒,一个用来存魔咒-
4000
-意思;
我用c++提交,结果超内存,后来用G++提交,就过了……
4000
-意思;
我用c++提交,结果超内存,后来用G++提交,就过了……
#include <iostream> #include <string> #include <map> using namespace std; int main() { int i,j,n; string st,str; map<string ,string> m; map<string,string> mm; while(1) { cin>>st; if(st=="@END@") break; cin.get(); getline(cin,str); mm[st]=str; m[str]=st; } cin>>n; cin.get(); while(n--) { getline(cin,str); if(mm[str]!="") cout<<mm[str]<<endl; else if(m[str]!="") { string k=m[str]; for(i=1;i<k.size()-1;i++) cout<<k[i]; cout<<endl; } else cout<<"what?"<<endl; } return 0; }
相关文章推荐
- hdu 1880 魔咒词典(字符串hash)
- HDU 1880 魔咒词典
- hdu1880之魔咒词典
- HDU 1880 魔咒词典
- Hdu 1880 魔咒词典(hash链表)
- HDU 1880 魔咒词典
- hdu 1880 魔咒词典
- HDU 1880 魔咒词典
- hdu1880魔咒词典 字符串哈希
- hdu1880 魔咒词典 (hash)
- hdu 1880 魔咒词典--字符串简单查找
- HDU1880-魔咒词典
- HDU-1880-魔咒词典【哈希(Hash)+二分】
- HDU 1880 魔咒词典(字符串哈希)
- HDU 1880 魔咒词典 字符串
- hdu 1880 魔咒词典 (字符串哈希)
- HDU 1880(魔咒词典)解题纠错
- hdu(1880):魔咒词典——字符串hash的应用
- hdu 1880 魔咒词典
- hdu 1880 魔咒词典(多种方法)