본문 바로가기
python-algorithm

[백준] 4592

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

1
2
3
4
5
6
7
8
9
10
11
12
import sys
while True:
    try:
        tmp=list(map(int,sys.stdin.readline().split()))
        ans=[]
        ans.append(tmp[1])
        for i in range(2,len(tmp)):
            if ans[-1]!=tmp[i] :ans.append(tmp[i])
        for i in range(len(ans)):
            print(ans[i],end=' ')
        print("$")
    except: exit()
cs
반응형

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

[백준] 4821  (0) 2021.01.08
[백준] 4740  (0) 2021.01.08
[백준] 4470  (0) 2021.01.08
[백준] 4458  (0) 2021.01.08
[백준] 3778  (0) 2021.01.08

댓글