BOJ - 14920 - 3n+1 수열

Updated:

def solution():

    N = int(input())
    count = 1

    while True:
        if N == 1:
            break
        if N % 2:
            N = N * 3 + 1
        else:
            N //= 2
        count += 1
    print(count)
solution()

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

Categories:

Updated:

Leave a comment