백준 17219 비밀번호 찾기 C++
2022. 5. 30. 21:58ㆍ카테고리 없음
728x90
map 함수란?
https://ls011031.tistory.com/51
[C++][STL] map 사용법 정리
1. map이란? map은 각 노드가 key와 value 쌍으로 이루어진 트리입니다. 특히, 중복은 허용하지 않습니다. 따라서 map은 first, second가 있는 pair 객체로 저장되는데 first-key, second-value로 저장됩니다. c++..
ls011031.tistory.com
#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
map<string, string> addres;
while (n--) {
string str, str1;
cin >> str >> str1;
addres.insert({ str,str1 })
}
while (m--) {
string key;
cin >> key;
cout << addres[key];
cout << '\n';
}
}
728x90