python3의 내장 정렬 함수는 'stable sort'입니다. 즉, 날먹하기 좋습니다.
This commit is contained in:
2
zeta_python/completed/10814.py
Normal file
2
zeta_python/completed/10814.py
Normal file
@@ -0,0 +1,2 @@
|
||||
N = int(input())
|
||||
for s in sorted([tuple(map(str, input().split())) for i in range(N)], key=lambda v: int(v[0])): print(s[0], s[1])
|
||||
3
zeta_python/completed/11651.py
Normal file
3
zeta_python/completed/11651.py
Normal file
@@ -0,0 +1,3 @@
|
||||
T = int(input())
|
||||
S = [tuple(map(int, input().split()))for _ in range(T)]; S.sort(key=lambda v: (v[1], v[0]))
|
||||
[print(i, j)for i, j in S]
|
||||
6
zeta_python/completed/1181.py
Normal file
6
zeta_python/completed/1181.py
Normal file
@@ -0,0 +1,6 @@
|
||||
N = int(input())
|
||||
S = [input() for i in range(N)]
|
||||
S = list(set(S))
|
||||
S.sort(key=lambda v: (len(v), v))
|
||||
for s in S:
|
||||
print(s)
|
||||
8
zeta_python/completed/1431.py
Normal file
8
zeta_python/completed/1431.py
Normal file
@@ -0,0 +1,8 @@
|
||||
N = int(input())
|
||||
|
||||
|
||||
def c(v):
|
||||
return sum([int(i) for i in v if i.isdigit()])
|
||||
|
||||
|
||||
for c in sorted([input() for i in range(N)], key=lambda v: (len(v), c(v), v)):print(c)
|
||||
7
zeta_python/completed/2752.py
Normal file
7
zeta_python/completed/2752.py
Normal file
@@ -0,0 +1,7 @@
|
||||
T = list(map(int, input().split()))
|
||||
for i in range(2):
|
||||
for j in range(2 - i):
|
||||
if T[j] > T[j + 1]:
|
||||
T[j], T[j + 1] = T[j + 1], T[j]
|
||||
for i in T:
|
||||
print(i, end=' ') # 버블
|
||||
Reference in New Issue
Block a user