IT/알고리즘

[백준] 좌표정렬하기 11650.python

Terriermon 2021. 2. 10. 00:43

 문제

- x랑 y를 따로따로 정렬하면 된다.

- 간단한 문제

 

 

 해설 및 코드

- 간단하지만 python 초보는 열심히 틀렸다.

- 아무래도 띄어쓰기 문제인듯... 백준 문제가 좀 아리까리했다.

 

N = int(input())

points = []

for _ in range(0,N):
    [x, y] = map(int, input().split())
    points.append( [x, y] )

points = sorted(points)


for i in range(N):
    print(points[i][0], points[i][1])

 

Python 문법 정리

- 원하는 변수를 list로 담기
[x, y] = map(int, input().split())

 

'IT > 알고리즘' 카테고리의 다른 글

[이코테] 큰 수의 법칙.python  (0) 2021.02.12
[백준] 책 나눠주기 9576.python  (0) 2021.02.11
[백준] 단어정렬 1181.python  (0) 2021.02.09
[백준] 보물 1026.python  (0) 2021.02.09
[백준] 에디터 1406.python  (0) 2021.02.07