제출 코드
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
package bronze;
import java.util.Scanner;
public class B13300_room {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int stdNum = sc.nextInt();
int roomMax = sc.nextInt();
int[][] stdList = new int[2][6];
for(int s=0; s<stdNum; s++) {
stdList[sc.nextInt()][sc.nextInt()-1]++;
}
int needRoom = 0;
for(int[] student : stdList) {
for(int s : student) {
needRoom += (s % roomMax == 0) ? s/roomMax : s/roomMax+1;
}
}
System.out.println(needRoom);
}
}