[파이썬][백준 5717번] 상근이의 친구들
1. 문제Permalink
[Bronze III] 상근이의 친구들 - 5717Permalink
성능 요약Permalink
메모리: 30840 KB, 시간: 68 ms
분류Permalink
사칙연산(arithmetic), 수학(math)
출처: 백준, https://https://www.acmicpc.net/
2. 해결방법 시간복잡도Permalink
- 단순 코딩 O(N)
3. 문제 해결 및 코드Permalink
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
while True: | |
A, B = map(int, sys.stdin.readline().split()) | |
if A == 0 and B == 0: | |
break | |
print(A + B) |
-
주석을 참고하면서 이해를 돕습니다.Permalink
4. 알고리즘 및 해설Permalink
- while문을 통해 입력받은 두 값이 0인 경우를 제외한 경우 계속해서 값을 입력받고 두 값의 합을 출력한다.