标签:题意 map exp lse == mem const constexpr sharp
题意:语言翻译,
直接map即可
#include "pch.h" #include <string> #include<iostream> #include<map> #include<memory.h> #include<vector> namespace cc { using std::cout; using std::endl; using std::cin; using std::map; using std::vector; using std::string; constexpr int N = 100000; string eh = "eh"; map<string, string>strMaps; void solve() { string str; int k = 0; while (getline(cin, str)) { if (str.size() == 0) break; int index = str.find(" "); string str1 = str.substr(0,index); string str2 = str.substr(index+1); strMaps[str2] = str1; } using IT = map<string, string>::iterator; while (getline(cin, str)) { IT it = strMaps.find(str); if (it == strMaps.end()) cout << eh << endl; else cout << it->second << endl; } } }; int main() { #ifndef ONLINE_JUDGE freopen("d://1.text", "r", stdin); #endif // !ONLINE_JUDGE cc::solve(); return 0; }
标签:题意 map exp lse == mem const constexpr sharp
原文地址:https://www.cnblogs.com/shuiyonglewodezzzzz/p/9902781.html