백준 6780번: Sumac Sequences #Python

ColorlessDia·2025년 10월 17일

algorithm/baekjoon

목록 보기
698/807
n1 = int(input())
n2 = int(input())

sequence = [n1, n2]

while True:
    t2 = sequence[-2]
    t1 = sequence[-1]
    tn = t2 - t1

    sequence.append(tn)

    if sequence[-2] < tn:
        break

print(len(sequence))

0개의 댓글