728x90
문제 링크: https://www.acmicpc.net/problem/24075
24075번: 計算 (Calculation)
2 つの整数 A, B が与えられる.A+B, A-B の中で最大の値と最小の値を順に出力せよ.
www.acmicpc.net
문제 풀이
a+b, a-b를 계산해주면 된다. 하지만 출력할 때 첫번째 줄에 둘 중 더 큰 것을 두번째 줄에 더 작은 것을 출력해줘야 한다.
코드
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
a, b = map(int, input().split()) | |
print(max(a+b, a-b)) | |
print(min(a+b, a-b)) |
728x90
'BOJ' 카테고리의 다른 글
[BOJ][Python] 백준 24268번 - 2022는 무엇이 특별할까? (0) | 2022.01.16 |
---|---|
[BOJ][Python] 백준 12851번 - 숨바꼭질 2 (0) | 2022.01.15 |
[BOJ][Python] 백준 18232번 - 텔레포트 정거장 (0) | 2022.01.15 |
[BOJ][Python] 백준 23842번 - 성냥개비 (0) | 2021.12.27 |
[BOJ][Python] 백준 23795번 - 사장님 도박은 재미로 하셔야 합니다 (0) | 2021.12.08 |