SW Expert Academy // 5431

2021. 1. 20. 13:10Programming/SW Expert Academy

SW Expert Academy 5431번 "민석이의 과제 체크하기" 문제입니다.

TC = int(input())
for tc in range(1, TC+1):
    N, M = map(int, input().split())
    lst = list(map(int, input().split()))
    ans = []
    for i in range(1, N+1):
        if i not in lst:
            ans.append(i)
    print("#%s"%tc, end=" ")
    for e in ans:
        print(e, end=" ")
    print()

과제를 제출하지 않은 사람의 번호를 오름차순으로 출력하는 문제다.

 

과제 제출한 리스트의 사람을 받고 for 반복문을 통하여 1부터 N까지 번호를 탐색한다.

 

for문의 i가 과제 제출 리스트 안에 존재하지 않는다면 제출하지 않은 리스트 ans에 추가한다.

'Programming > SW Expert Academy' 카테고리의 다른 글

SW Expert Academy // 5162  (0) 2021.01.20
SW Expert Academy // 5356  (0) 2021.01.20
SW Expert 아카데미 // 5515  (0) 2021.01.19
SW Expert 아카데미 // 5688  (0) 2021.01.19
SW Expert 아카데미 // 5789  (0) 2021.01.19