알고리즘/백준 ~ 단계별 풀어보기 (21) 썸네일형 리스트형 백준 2108 "통계학" Python import sys from typing import Counter n = int(input()) k = [] answer = [] for _ in range(n): k.append(int(sys.stdin.readline())) sortedK = sorted(k) arithmeticMean = sum(k)/n median = sortedK[n//2] r = max(k) - min(k) mode = 0 count = Counter(sortedK).most_common() if len(count) >= 2 and count[0][1] == count[1][1]: mode = count[1][0] else: mode = count[0][0] print(round(arithmeticMean)) p.. 백준 2751 "수 정렬하기 2" Python n = int(input()) k = [] for _ in range(n): k.append(int(input())) k = set(k) k = list(k) k.sort() for i in k: print(i) 백준 2750 "수 정렬하기" Python n = int(input()) k = [] for _ in range(n): k.append(int(input())) k = set(k) k = list(k) k.sort() print(*k) 백준 10870 "피보나치 수 5" Python n = int(input()) if n == 0 : print(0) exit() if n == 1 : print(1) exit() dp = [0]*(n+1) dp[1] = 1 for i in range(2,n+1): dp[i] = dp[i-1] +dp[i-2] print(dp[n]) 백준 10872번 def recursive(n): if n == 1: return 1 return n*recursive(n-1) n = int(input()) if n == 0 : print(1) exit() print(recursive(n)) 이전 1 2 3 다음