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 |
Tags
- 누적 합
- 스택
- 백트래킹
- 다이나믹 프로그래밍
- VR
- 구현
- 자료구조
- 우선순위 큐
- 투 포인터
- 백준
- 시뮬레이션
- 다익스트라
- c++
- 정렬
- 문자열
- 재귀
- 수학
- XR Interaction Toolkit
- 유니티
- BFS
- 알고리즘
- 그리디 알고리즘
- ue5
- 브루트포스
- 그래프
- DFS
- 유니온 파인드
- Unreal Engine 5
- Team Fortress 2
- 트리
Archives
- Today
- Total
1일1알
백준 1380번 귀걸이 C++ 본문
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
using namespace std;
using ll = long long;
int dRow[4] = { -1,0,1,0 };
int dCol[4] = { 0,1,0,-1 };
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int cnt = 1;
while (true) {
int n;
cin >> n;
if (n == 0) break;
vector<string> v(n + 1);
map<string, int> mp;
cin.ignore();
for (int i = 1; i <= n; i++) {
getline(cin, v[i]);
}
for (int i = 0; i < 2 * n - 1; i++) {
int num;
char c;
cin >> num >> c;
mp[v[num]]++;
}
string name = "";
for (auto a : mp) {
if (a.second == 1)
name = a.first;
}
cout << cnt << " " << name << "\n";
cnt++;
}
};
'알고리즘' 카테고리의 다른 글
백준 1421번 나무꾼 이다솜 C++ (0) | 2022.04.27 |
---|---|
백준 1385번 벌집 C++ (0) | 2022.04.26 |
백준 1347번 미로 만들기 C++ (0) | 2022.04.24 |
백준 1337번 올바른 배열 C++ (0) | 2022.04.23 |
백준 1331번 나이트 투어 C++ (0) | 2022.04.22 |