Skip to content

Commit 5bec0b0

Browse files
committed
[Simulation] baekjoon-13300
1 parent 070540d commit 5bec0b0

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
| 13 | | [Baekjoon-17281 ⚾](./src/Simulation/P17281) | 삼성 A형 기출 |
4343
| 14 | | [Baekjoon-3954 Brainf**k 인터프리터](./src/Simulation/P3954) | 삼성 A형 기출 |
4444
| 15 | | [Baekjoon-10163 색종이](./src/Simulation/P10163) | |
45+
| 16 | | [Baekjoon-13300 방 배정](./src/Simulation/P13300) | |
4546

4647
## String
4748

src/Simulation/P13300/Main.java

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package Simulation.P13300;
2+
3+
import java.io.BufferedReader;
4+
import java.io.FileInputStream;
5+
import java.io.InputStreamReader;
6+
import java.util.StringTokenizer;
7+
8+
public class Main {
9+
10+
static int N, K, S, Y, ans;
11+
static int[][] students = new int[7][2];
12+
13+
public static void main(String[] args) throws Exception {
14+
System.setIn(new FileInputStream("src/Simulation/P13300/input.txt"));
15+
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
16+
StringTokenizer st = new StringTokenizer(br.readLine());
17+
18+
N = Integer.parseInt(st.nextToken());
19+
K = Integer.parseInt(st.nextToken());
20+
21+
for (int i = 0; i < N; i++) {
22+
st = new StringTokenizer(br.readLine());
23+
S = Integer.parseInt(st.nextToken());
24+
Y = Integer.parseInt(st.nextToken());
25+
students[Y][S] ++;
26+
}
27+
28+
for (int i = 1; i <= 6; i++) {
29+
for (int j = 0; j < 2; j++) ans += Math.ceil((double) students[i][j] / K);
30+
}
31+
32+
System.out.println(ans);
33+
}
34+
}

src/Simulation/P13300/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## [baekjoon-13300] 방 배정
2+
3+
![image](https://user-images.githubusercontent.com/22045163/109003448-ce453900-76ea-11eb-93c7-eb970f532bb3.png)
4+
![image](https://user-images.githubusercontent.com/22045163/109003495-ddc48200-76ea-11eb-9e99-80f69701afbd.png)
5+
6+
![image](https://user-images.githubusercontent.com/22045163/109003538-e917ad80-76ea-11eb-868f-fc99debf7de3.png)

src/Simulation/P13300/input.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
3 3
2+
0 3
3+
1 5
4+
0 6

0 commit comments

Comments
 (0)