자윤이와고리즘/Code
[프로그래머스] 예상 대진표
EUJU
2019. 8. 13. 15:06
#include <iostream>
using namespace std;
int solution(int n, int a, int b)
{
int answer = 0;
while(true){
answer ++;
if(a%2 ==0 )
a = a/2;
else
a = a/2 + 1;
if(b%2 == 0)
b = b/2;
else
b = b/2 + 1;
if(a == b)
break;
}
return answer;
}