반응형
https://www.acmicpc.net/problem/2108
# @Author YoungMinKim
# baekjoon
import sys
from collections import Counter
N= int(sys.stdin.readline())
arr = []
for _ in range(N):
arr.append(int(sys.stdin.readline()))
arr.sort()
avg=sum(arr)/len(arr)
median = arr[len(arr)//2]
mode = Counter(arr).most_common() # count value
maximum = mode[0][1]
tmp=[]
for i in mode:
if i[1] == maximum:
tmp.append(i[0])
print(round(avg))
print(median)
if len(tmp)==1:
print(sorted(tmp)[0])
else:
print(sorted(tmp)[1])
print(max(arr) - min(arr))
numpy가 땡기는 문제였다...
numpy 짱짱...
반응형
'백준 문제풀이' 카테고리의 다른 글
baekjoon - python - 4673 (0) | 2020.08.28 |
---|---|
baekjoon - python -2839 (0) | 2020.08.28 |
baekjoon - python - 9653 (0) | 2020.08.27 |
baekjoon - python - 9498 (0) | 2020.08.27 |
baekjoon - python - 9316 (0) | 2020.08.27 |
댓글