728x90
4909번: Judging Olympia
For years, a group of Regional Contest Directors (RCDs) of the ACM International Collegiate Programming Contest (ICPC) have been unsatisfied with the way contest submissions get ranked. The group sees it is academically wrong to emphasize the importance of
www.acmicpc.net
문제 풀이
6개의 점수 중 최댓값과 최솟값을 뺀 4개의 수의 평균을 구해 출력해주는 문제이다. 단, 출력값에는 불필요한 0이 포함되지 않아야한다.
따라서, 자연수일 경우는 int형으로 출력해야하고, 그 외의 값들은 float형으로 출력해준다.
정답 코드
while True :
lst = list(map(int, input().split()))
if sum(lst) == 0 : break
score = sum(lst) - max(lst) - min(lst)
if score / 4 % 1 == 0 : print(score // 4)
else : print(score / 4)
728x90
'Algorithm > PS' 카테고리의 다른 글
[BOJ/백준] 5013 - Death Knight Hero [python] (0) | 2023.03.12 |
---|---|
[BOJ/백준] 4922 - Walk Like an Egyptian [python] (0) | 2023.03.12 |
[BOJ/백준] 4892 - 숫자 맞추기 게임 [python] (0) | 2023.03.12 |
[BOJ/백준] 4880 - 다음수 [python] (0) | 2023.03.12 |
[BOJ/백준] 4806 - 줄 세기 [python] (0) | 2023.03.12 |