BOJ 1620 나는야 포켓몬 마스터 이다솜

1 개요[ | ]

BOJ 1620 나는야 포켓몬 마스터 이다솜


2 C++[ | ]

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N, M;
    cin >> N >> M;
    int i, j;
    map<string, int> map1;
    map<int, string> map2;
    string temp;
    for(i=0; i<N; i++) {
        cin >> temp;
        map1[temp] = i+1;
        map2[i+1] = temp;
    }
    for(i=0; i<M; i++) {
        cin >> temp;
        if('0' <= temp[0] && temp[0] <= '9') {
            cout << map2[stoi(temp)] << "\n";
            continue;
        }
        cout << map1[temp] << "\n";
    }
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}