We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 69f1c2c commit a35783bCopy full SHA for a35783b
Baekjoon/hyeonyoung/추월.cpp
@@ -0,0 +1,47 @@
1
+// 221229_BOJ_2002
2
+
3
+#include <iostream>
4
+#include <string>
5
+#include <vector>
6
+#include <map>
7
8
+using namespace std;
9
10
+int N, answer = 0;
11
+vector<string> E;
12
+map<string, int> S;
13
14
+int main()
15
+{
16
+ ios::sync_with_stdio(0);
17
+ cin.tie(0);
18
19
+ cin >> N;
20
+ for (int i = 0; i < N; ++i)
21
+ {
22
+ string str;
23
+ cin >> str;
24
+ S[str] = i;
25
+ }
26
27
28
29
30
+ E.push_back(str);
31
32
33
34
35
+ for (int j = i + 1; j < N; ++j)
36
37
+ if (S[E[i]] > S[E[j]])
38
39
+ answer++;
40
+ break;
41
42
43
44
+ cout << answer;
45
46
+ return 0;
47
+}
0 commit comments