알고리즘/SwExpert recipe

[SWEA] 민석이의 과제제출하기 [D3]

컵라면만두세트 2021. 3. 29. 23:39

처음 알고리즘을 접했을땐 정말 어렵다고 생각했는데..

많이 성장한듯 하다.

package D3;

import java.util.Arrays;
import java.util.Scanner;

public class 민석이의과제체크하기 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int T =sc.nextInt();
		for(int tc=1; tc<=T; tc++) {
			int N = sc.nextInt();// 수강생수
			int K = sc.nextInt();// 과제를 제출한사람
			
			int cnt[] = new int[N+1];
			int ans[] = new int[N+1];
			for(int i=1; i<=K; i++) {
				cnt[sc.nextInt()]++;
			}
			System.out.print("#" + tc +" ");
			for(int i =1; i<=N; i++) {
				if(cnt[i] == 0) {
					System.out.print(i+ " ");
				}
			}
			System.out.println();
		}
	}

}