Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hadongun/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
| 7μ°¨μ‹œ | 2025.04.07 | μŠ€νƒ | [κ· ν˜• 작힌 세상](https://www.acmicpc.net/problem/4949)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/25|
| 8μ°¨μ‹œ | 2025.04.09 | 그리디 μ•Œκ³ λ¦¬μ¦˜ | [μ•Œλ°”μƒ κ°•ν˜Έ](https://www.acmicpc.net/problem/1758)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/29|
| 9μ°¨μ‹œ | 2025.05.02 | μŠ€νƒ | [제둜](https://www.acmicpc.net/problem/10773)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/36|
---
| 10μ°¨μ‹œ| 2025.05.07 | μˆ˜ν•™ | [톡계학](https://www.acmicpc.net/problem/2108)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/36|
80 changes: 80 additions & 0 deletions hadongun/μˆ˜ν•™/톡계학.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import sys
N = int(input())
su = []
for _ in range(N):
su.append(int(sys.stdin.readline()))
su.sort()
length = len(su)

#μ‚°μˆ ν‰κ· 
average = 0
for i in range(length):
average += su[i]
print(average//length)

#쀑앙값
print(su[(length//2)])
#μ΅œλΉˆκ°’
count = [0]*8001
for ch in su:
count[ch + 4000] += 1
Max = count[0]
temp = 0
max_list = []
Max = max(count)
for k in range(len(count)):
if count == Max:
max_list.append(k-4000)
if len(max_list) > 1:
print(max_list[1])
else:
print(max_list[0])

print(temp-4000)

#λ²”μœ„
print(su[length-1] - su[0])

""""
#μ΅œλΉˆκ°’ μ‹€νŒ¨
yang = [0]*500001
emm = [0]*500001
for i in range(length):
if su[i] >= 0:
yang[su[i]] += 1
else:
emm[abs(su[i])] += 1
Max = 0
count = 0
dex = 0

for j in range(500001):
if Max < yang[j]:
Max = yang[j]
dex = j
elif Max < emm[j]:
Max = emm[j]
dex = -j
elif Max == emm[j]:
count += 1
if count == 2:
dex = -j
Max = emm[j]

elif Max == yang[j]:
count += 1
if count == 2:
dex = j
Max = yang[j]

print(dex)
""""