8000 Merge pull request #426 from haneulkimdev/patch-3 · dostiny/basic-algo-lecture@5b0199f · GitHub
[go: up one dir, main page]

Skip to content

Commit 5b0199f

Browse files
Merge pull request encrypted-def#426 from haneulkimdev/patch-3
Create 1057_1.cpp
2 parents 4261869 + 8c0bfe5 commit 5b0199f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

0x12/solutions/1057_1.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Authored by : haneulkimdev
2+
// Co-authored by : -
3+
// http://boj.kr/ad7d6ee177654e6dbc83931bc7265b7a
4+
#include <bits/stdc++.h>
5+
using namespace std;
6+
7+
int main(void) {
8+
ios::sync_with_stdio(0);
9+
cin.tie(0);
10+
int n, a, b;
11+
cin >> n >> a >> b;
12+
int ans = 0;
13+
while (a != b) {
14+
a = (a + 1) / 2;
15+
b = (b + 1) / 2;
16+
ans++;
17+
}
18+
cout << ans;
19+
}
20+
21+
/*
22+
모든 참가자의 경기를 시뮬레이션하는 대신 두 명의 번호만 관리하는 풀이
23+
*/

0 commit comments

Comments
 (0)
0