提交 8e53e59d 编写于 作者: CairBin's avatar CairBin

2022-09-08 新增STL_V题的题解

上级 16be5660
......@@ -5,6 +5,13 @@
"stack": "cpp",
"queue": "cpp",
"ostream": "cpp",
"type_traits": "cpp"
"type_traits": "cpp",
"xutility": "cpp",
"deque": "cpp",
"initializer_list": "cpp",
"vector": "cpp",
"xhash": "cpp",
"xstring": "cpp",
"xtree": "cpp"
}
}
\ No newline at end of file
/*
* Description
* @url:https://vjudge.csgrandeur.cn/contest/513104#problem/V
* @author:CairBin
* @since:2022-09-08
*/
#include <iostream>
#include <string>
#include <map>
#include <sstream>
#include <vector>
using namespace std;
vector<string> split(string str, const char c)
{
vector<string> res;
stringstream ss(str);
string temp;
while(getline(ss, temp, c))
res.push_back(temp);
return res;
}
int main()
{
map<string, string> dict;
string str;
while(getline(cin, str))
{
if (str.length() == 0)
break;
vector<string> res = split(str, ' ');
dict.insert(make_pair(res[1], res[0]));
}
while(getline(cin, str))
{
if(dict.count(str) > 0)
cout << dict[str] << endl;
else
cout << "eh" << endl;
}
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册