본문 바로가기
백준

[1057] 토너먼트

by Jcoder 2018. 8. 13.


#include<iostream>
using namespace std;
int main()
{
int total, kim, im, count = 0;
cin >> total >> kim >> im;
if (total < kim || total < im)
{
count = -1;
}
else
{
while (kim != im)
{
kim = (kim + 1) / 2;
im = (im + 1) / 2;
count++;
}
}
cout << count << endl;
return 0;
}


'백준' 카테고리의 다른 글

[15953] 상금 헌터  (0) 2018.08.18
[2740] 행렬 곱셈  (0) 2018.08.13
[1094] 막대기  (0) 2018.08.13
[2455] 지능형 기차  (0) 2018.08.12
[3036] 링  (0) 2018.08.12