CodeForces 918B - Radio Station

前天CF排位赛的题
考验对STL的运用...

来源 Codeforces Round #459 (Div. 2)

1.png
2.png

Accept GNU G++14 6.2.0 15ms 2072kB

/**
 * @author    Moe_Sakiya        i@tun.moe
 * @date        2018-01-29 23:36:36
 *
 */

#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <queue>

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>

using namespace std;

string name[1000];
map<string, int> smap;

int main(void) {
    string command, ip;
    int i, n, m;
    cin >> n >> m;
    for (i = 0; i < n; i++) {
        cin >> command >> ip;
        name[i] = command;
        smap[ip] = i;
    }
    for (i = 0; i < m; i++) {
        cin >> command >> ip;
        ip.pop_back();
        cout << command << " " << ip << "; #" << name[smap[ip]] << endl;
    }
    return 0;
}

    • 2018-03-01 12:58 回复

      某日,博主终于记起来她的博客密码,然后水了一篇我看不懂的文章

添加新评论

captcha
请输入验证码