[python]백준 1094번 오답노트

김보현·2024년 7월 25일
0

PS

목록 보기
56/62

백준 1094번 막대기 문제
64는 262^6이기 때문에 stick은 결국 2의 제곱수를 가장 적게 사용해서 만들어진다.

import sys
input = sys.stdin.readline
x = int(input())
cnt = 0
stick = 0
short = 64
while stick != x:
    if x - stick >= short:
    	stick += short
    	cnt += 1
    short /= 2
print(cnt)
profile
Fall in love with Computer Vision

0개의 댓글

관련 채용 정보