[JAVA] SWEA 5431 - 민석이의 과제 체크하기

7101 단어 algorithmSWEASWEA

import java.util.*;
class Solution
{
	public static void main(String args[]) throws Exception
	{
		Scanner sc = new Scanner(System.in);
        StringBuffer sb = new StringBuffer();

        int T = sc.nextInt();
        for(int tc=1; tc<=T; tc++){
            sb.append("#").append(tc).append(" ");

            int N = sc.nextInt();
            boolean student[] = new boolean[N+1];

            int K = sc.nextInt();
            for(int i=0; i<K; i++){
                student[sc.nextInt()] = true;
            }

            for(int i=1; i<=N; i++){
                if(!student[i])
                    sb.append(i).append(" ");
            }
            sb.append("\n");

        }
        System.out.println(sb);

    }
}

좋은 웹페이지 즐겨찾기