Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- BOJ
- 운영체제
- redis
- inflearn
- 열혈 TCP/IP 소켓 프로그래밍
- Operating System.
- TCP/IP
- 토마토
- 스프링 핵심 원리
- 에러핸들링
- Operating System
- OS
- Four Squares
- 스프링 입문
- 이펙티브코틀린
- HTTP
- 우아한레디스
- FIFO paging
- 2475번
- 우아한 테크 세미나
- 윤성우 저자
- Window-Via-c/c++
- 김영한
- C#
- 10026번
- 제프리리처
- Spring
- 열혈 tcp/ip 프로그래밍
- C++
- n타일링2
Archives
- Today
- Total
나의 브을로오그으
[c++] 1620번 : 나는야 포켓몬 마스터 이다솜 본문
https://www.acmicpc.net/problem/1620
#include <iostream>
#include <unordered_map>
#include <string>
using namespace std;
bool isNumber(const char* str)
{
int dist = str[0] - '0';
return 0 <= dist && dist <= 9;
}
string strArr[100001];
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int N, M;
cin >> N >> M;
string name;
unordered_map<string, int> books;
for (int i = 1; i <= N; ++i)
{
cin >> name;
books.insert(make_pair(name, i));
strArr[i] = name;
}
for (int i = 0; i < M; ++i)
{
string input;
cin >> input;
if (isNumber(input.c_str()) == true)
{
int num = stoi(input);
cout << strArr[num] << '\n';
}
else
{
cout << books[input] << '\n';
}
}
return 0;
}
'알고리즘 > BaekJoon' 카테고리의 다른 글
[c++] 1697번 : 숨바꼭질 (0) | 2022.06.14 |
---|---|
[c++] 1676번 : 팩토리얼 0의 개수 (0) | 2022.06.12 |
[c++] 1541번 : 잃어버린 괄호 (0) | 2022.06.07 |
[c++] 1463번 : 1로 만들기 (0) | 2022.06.03 |
[c++] 1389번 : 케빈 베이컨의 6단계 법칙 (0) | 2022.06.02 |