【Codeforces Round #459 (Div. 2) B】 Radio Station

【链接】 我是链接,点我呀:)
【题意】

在这里输入题意

【题解】

用map模拟一下映射就好了。

【代码】

#include <bits/stdc++.h>
using namespace std;

int n,m;

map<string,string> dic;

int main(){
	#ifdef LOCAL_DEFINE
	    freopen("rush_in.txt", "r", stdin);
	#endif
	ios::sync_with_stdio(0),cin.tie(0);
    cin >> n >> m;
    for (int i = 1;i <= n;i++){
        string name,ip;
        cin >> name>>ip;
        dic[ip] = name;
    }
    for (int i = 1;i <= m;i++){
        string x,y;
        cin >> x >> y;
        cout<<x<<' '<<y;
        int len = y.size();
        y = y.substr(0,len-1);
        cout<<" #"<<dic[y]<<endl;
    }
	return 0;
}
posted @ 2018-01-30 11:11  AWCXV  阅读(146)  评论(0编辑  收藏  举报