1. Problem
2. My Solution
import sys
n = int(sys.stdin.readline().strip())
count_list = [0 for _ in range(10001)]
for i in range(n):
num = int(sys.stdin.readline().strip())
count_list[num] += 1 # count
for i in range(len(count_list)):
for _ in range(count_list[i]):
print(i)
3. Learned
1. Problem
2. My Solution
import sys
import statistics
n = int(sys.stdin.readline().strip())
num_list = []
for _ in range(n):
num_list.append(int(sys.stdin.readline().strip()))
num_list.sort()
count = statistics.multimode(num_list)
print(round(statistics.mean(num_list)))
print(statistics.median(num_list))
if len(count) == 1:
print(count[0])
else:
print(count[1])
print(num_list[-1]-num_list[0])
3. Others' Solutions
4. Learned
1. Problem
2. My Solution
import sys
test_n = int(sys.stdin.readline().strip())
xy_list = []
for _ in range(test_n):
xy_list.append(list(map(int,sys.stdin.readline().strip().split())))
xy_list.sort(key=lambda x: (x[1],x[0]))
for i in xy_list:
print(' '.join(map(str,i)))
3. Learned
1. Problem
2. My Solution
import sys
test_n = int(sys.stdin.readline().strip())
user_info = []
for _ in range(test_n):
user_info.append(sys.stdin.readline().strip().split())
user_info.sort(key=lambda x:x[0])
for i in user_info:
print(' '.join(map(str,i)))
3. Others' Solutions
import sys
test_n = int(sys.stdin.readline().strip())
user_info = []
for _ in range(test_n):
age, name = sys.stdin.readline().strip().split()
user_info.append([int(age),name])
user_info.sort(key=lambda x:x[0])
for i in user_info:
print(' '.join(map(str,i)))
4. Learned
1. Problem
2. My Solution
import sys
test_n = int(sys.stdin.readline().strip())
num_list = list(map(int,sys.stdin.readline().strip().split()))
set_list = sorted(list(set(num_list)))
count_list =[]
for i in num_list:
print(set_list.index(i), end=' ')
3. Others' Solutions
import sys
test_n = int(sys.stdin.readline().strip())
num_list = list(map(int,sys.stdin.readline().strip().split()))
set_list = sorted(list(set(num_list)))
dic_list = {set_list[i]:i for i in range(len(set_list))}
for i in num_list:
print(dic_list[i], end=' ')
4. Learned