Skip to content

Commit 72f5719

Browse files
committed
Add 예상 대진표
1 parent 3e2e1c2 commit 72f5719

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Programmers/예상 대진표.swift

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import Foundation
2+
3+
func solution(_ n:Int, _ a:Int, _ b:Int) -> Int
4+
{
5+
var a = a
6+
var b = b
7+
var answer = 0
8+
9+
while a != b {
10+
a += a % 2
11+
a /= 2
12+
b += b % 2
13+
b /= 2
14+
15+
answer += 1
16+
}
17+
18+
return answer
19+
}

0 commit comments

Comments
 (0)