Baekjoon/Silver

Baekjoon 17219.비밀번호 찾기 c++ [Silver IV]

Hun-bot 2024. 12. 23. 14:05
728x90
반응형

단순 구현

#include <iostream>
#include <unordered_map>
#include <string>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int N, M;
    cin >> N >> M;
    unordered_map<string, string> sites;
    while (N--)
    {
        string site, password;
        cin >> site >> password;
        sites[site] = password;
    }
    while (M--)
    {
        string find_site;
        cin >> find_site;
        if (sites.find(find_site) != sites.end())
        {
            cout << sites[find_site] << '\n';
        }
    }
    return 0;
}
728x90
반응형