Algorithm/SWEA

[swexpert] 5431. 민석이의과제체크하기

반응형

[swexpert] 5431. 민석이의과제체크하기


문제 출처


https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWVl3rWKDBYDFAXm&categoryId=AWVl3rWKDBYDFAXm&categoryType=CODE




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.util.Scanner;
 
public class Solution_5431 {
 
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int ts = sc.nextInt();
        
        for (int i = 0; i < ts; i++) {
            
            //첫째 줄
            int stu = sc.nextInt(); //수강생 수
            int okNum = sc.nextInt(); //과제 제출 사람 수
            
            int[] stuNum = new int[stu]; // 수강생 수 만큼 배열 생성
            
            for (int j = 0; j < okNum; j++) { // 제출 사람 저장
                int num = sc.nextInt();
                stuNum[num-1]++;
            }
            
            System.out.print("#" + (i+1+ " ");
            
            for (int j = 0; j < stuNum.length; j++) { // 제출 안한 사람 출력
                if(stuNum[j] == 0) {
                    System.out.print(j+1 + " ");
                }
            }
            System.out.println();
            
        }
    }
 
}
cs


반응형

'Algorithm > SWEA' 카테고리의 다른 글

[swexpert] 1225. 암호생성기  (0) 2019.01.11
[swexpert] 1206. View  (0) 2019.01.11
[swexpert] 1208. Flatten  (0) 2019.01.08
[swexpert] 2063. 중간값 찾기  (0) 2019.01.07
[swexpert] 1204. 최빈수 구하기  (0) 2019.01.07