BAEKJOON : 10989, 2108, 11651, 10814, 18870
No. 10989
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 No. 2108
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 No. 11651
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 No. 10814
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 No. 18870
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 Reference
この問題について(BAEKJOON : 10989, 2108, 11651, 10814, 18870), 我々は、より多くの情報をここで見つけました https://velog.io/@codren/BAEKJOON-5b3o8uvkテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol