[SWEA/Python] 21425번. += (D2)

문제

https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AZD8K_UayDoDFAVs

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

 

풀이

더해지는 숫자가 클수록 이득이다.

임계값 N을 초과할때까지 A, B중 작은수에 큰 수를 더하면서 더하는 횟수를 세면 된다.

 

 

 

정답 코드

T = input()

testCases = [list(map(int, input().split())) for _ in range(int(T))]

for testCase in testCases:
    answer = 0
    while testCase[2] >= max(testCase[:2]):
        if testCase[0] <= testCase[1]:
            testCase[0] += testCase[1]
        else:
            testCase[1] += testCase[0]
        answer += 1
    print(answer)