[파이썬][백준 10817번] 세 수
1. 문제Permalink
[Bronze III] 세 수 - 10817Permalink
성능 요약Permalink
메모리: 30840 KB, 시간: 68 ms
분류Permalink
구현(implementation)
문제 설명Permalink
세 정수 A, B, C가 주어진다. 이때, 두 번째로 큰 정수를 출력하는 프로그램을 작성하시오.
입력Permalink
첫째 줄에 세 정수 A, B, C가 공백으로 구분되어 주어진다. (1 ≤ A, B, C ≤ 100)
출력Permalink
두 번째로 큰 정수를 출력한다.
출처: 백준, https://https://www.acmicpc.net/
2. 해결방법 시간복잡도Permalink
- 단순 코딩 O(1)
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
A, B, C = map(int, input().split()) | |
if A >= B and A <= C or A >= C and A <= B: | |
print(A) | |
elif B >= C and B <= A or B >= A and B <= C: | |
print(B) | |
else: | |
print(C) |
-
주석을 참고하면서 이해를 돕습니다.Permalink
4. 알고리즘 및 해설Permalink
- 받아야 할 값을 map()함수를 통해 모두 받는다.
- if문을 통해 해당 문제에서 제시하는 모든 경우의 수를 만들어 출력한다.