알고리즘/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();
		}
	}

}

'알고리즘 > SwExpert recipe' 카테고리의 다른 글

[SWEA] 최대 성적표 만들기 [D3]  (0) 2021.04.09
[SWEA] 두문자어 [D3]  (0) 2021.04.08
[SWEA] 직사각형 길이 찾기 [D3]  (0) 2021.03.29
[SWEA] 사람 네트워크 D6  (0) 2021.03.25
[SWEA] 준홍이의카드놀이 D3  (0) 2021.03.25