Skip to content

Commit 070540d

Browse files
committed
[Simulation] baekjoon-10163
1 parent 421be20 commit 070540d

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed

โ€ŽREADME.md

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
| 12 | | [Baekjoon-17135 ์บ์Šฌ ๋””ํŽœ์Šค](./src/Simulation/P17135) | ์‚ผ์„ฑ Aํ˜• ๊ธฐ์ถœ |
4242
| 13 | | [Baekjoon-17281 โšพ](./src/Simulation/P17281) | ์‚ผ์„ฑ Aํ˜• ๊ธฐ์ถœ |
4343
| 14 | | [Baekjoon-3954 Brainf**k ์ธํ„ฐํ”„๋ฆฌํ„ฐ](./src/Simulation/P3954) | ์‚ผ์„ฑ Aํ˜• ๊ธฐ์ถœ |
44+
| 15 | | [Baekjoon-10163 ์ƒ‰์ข…์ด](./src/Simulation/P10163) | |
4445

4546
## String
4647

โ€Žsrc/Simulation/P10163/Main.java

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package Simulation.P10163;
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, x, y, w, h;
11+
static int[][] map = new int[102][102];
12+
static int[] area;
13+
14+
public static void main(String[] args) throws Exception {
15+
System.setIn(new FileInputStream("src/Simulation/P10163/input.txt"));
16+
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
17+
18+
N = Integer.parseInt(br.readLine());
19+
for (int n = 1; n <= N; n++) {
20+
StringTokenizer st = new StringTokenizer(br.readLine());
21+
x = Integer.parseInt(st.nextToken());
22+
y = Integer.parseInt(st.nextToken());
23+
w = Integer.parseInt(st.nextToken());
24+
h = Integer.parseInt(st.nextToken());
25+
26+
for (int i = y; i < y+h; i++) {
27+
for (int j = x; j < x+w; j++) {
28+
map[i][j] = n;
29+
}
30+
}
31+
}
32+
33+
area = new int[N+1];
34+
for (int i = 0; i < 102; i++) {
35+
for (int j = 0; j < 102; j++) {
36+
area[map[i][j]] ++;
37+
}
38+
}
39+
40+
for (int i = 1; i <= N; i++) System.out.println(area[i]);
41+
}
42+
}

โ€Žsrc/Simulation/P10163/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## [baekjoon-10163] ์ƒ‰์ข…์ด
2+
3+
![image](https://user-images.githubusercontent.com/22045163/109001544-6a217580-76e8-11eb-9ecd-6c5e80c546fd.png)
4+
![image](https://user-images.githubusercontent.com/22045163/109001592-77d6fb00-76e8-11eb-927e-19f2225e123c.png)
5+
6+
![image](https://user-images.githubusercontent.com/22045163/109001634-845b5380-76e8-11eb-823a-ce8d1629d0ee.png)

โ€Žsrc/Simulation/P10163/input.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
4
2+
0 2 10 10
3+
7 9 8 4
4+
8 4 10 6
5+
6 0 12 10

0 commit comments

Comments
ย (0)