본문 바로가기
python-algorithm

백준 11650 좌표 정렬하기

by 무적김두칠 2021. 8. 23.

1
2
3
4
5
6
7
8
9
pythotmp=[]
n=int(input())
for i in range(n):
    a,b=map(int,input().split())
    tmp.append((a,b))
 
tmp=sorted(tmp, key= lambda x: (x[0],x[1]))
for i in tmp:
    print (i[0],i[1])
cs

요거는 lambda 이용해서 sort 두번 하면됩니다!

반응형

'python-algorithm' 카테고리의 다른 글

백준 2164 카드 2  (0) 2021.08.24
백준 10814 나이순 정렬  (0) 2021.08.23
백준 2702 초6 수학  (0) 2021.08.19
백준 3040 백설 공주와 일곱 난쟁이  (0) 2021.08.19
Leetcode Add Strings  (0) 2021.08.19

댓글