본문 바로가기
python-algorithm

codeforces 978A - Remove Duplicates

by 무적김두칠 2022. 5. 26.

1
2
3
4
5
6
7
8
9
10
def sol(n,nums):
    ans=[]
    for i in range(1,n+1):
        if nums[-i] not in ans:
            ans.append(nums[-i])
    print(len(ans))
    print(*ans[::-1])
n=int(input())
nums=list(map(int,input().split()))
sol(n,nums)
cs
반응형

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

백준 24923 Canadians, eh?  (0) 2022.05.26
백준 24927 Is It Even?  (0) 2022.05.26
codeforces 1206A - Choose Two Numbers  (0) 2022.05.26
codeforces 118A - String Task  (0) 2022.05.25
codeforces 1A - Theatre Square  (0) 2022.05.25

댓글