[백준 1057 파이썬] 토너먼트

일단 해볼게·2022년 11월 1일
0

백준

목록 보기
41/132

https://www.acmicpc.net/problem/1057


input1 = sys.stdin.readline().split()
input1 = list(map(int,input1))
# n,start,end=map(int, input().split()) # 이렇게 바로 변수로 넣는것도 가능

round = 0
# input1[0] = 참가자 수, input1[1] = 김지민 번호. input1[2] = 임한수 번호

while input1[1] != input1[2]:
    input1[1] -= input1[1] // 2  # 그림 그려보고 토너먼트의 특징을 기억하면 이 값이 라운드 수라는걸 알 수 있다.
    input1[2] -= input1[2] // 2  
    round += 1

print(round)

# ex) 8, 9
# 8 -> 4 -> 2 -> 1 -> 1
# 9 -> 5 -> 3 -> 2 -> 1
profile
시도하고 More Do하는 백엔드 개발자입니다.

0개의 댓글