문제
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)
'알고리즘 > SWEA' 카테고리의 다른 글
[SWEA/Python] 1215번. [S/W 문제해결 기본] 3일차 - 회문1 (D3) (0) | 2024.11.14 |
---|---|
[SWEA/Python] 1289번. 원재의 메모리 복구하기 (D3) (0) | 2024.11.13 |
[SWEA/Python] 1954번. 달팽이 숫자 (D2) (0) | 2024.11.12 |