알고리즘/소스코드
KOREATECH 1074: 유일한 수 두개
cjw.git
2021. 1. 23. 06:19
Link : judge.koreatech.ac.kr/problem.php?id=1074
Python
더보기
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
from sys import stdin
testcase = int(stdin.readline().strip())
while testcase:
stack = []
data_length = int(stdin.readline().strip())
data = [int(i) for i in stdin.readline().strip().split(' ')]
data.sort()
for i in data:
if len(stack) == 0:
stack.append(i)
else:
if stack[-1] == i:
stack.pop()
else:
stack.append(i)
print(' '.join([str(i) for i in stack]))
testcase -= 1
|
cs |
FeedBack
cjw.git@gmail.com