Skip to content
This repository was archived by the owner on Feb 13, 2024. It is now read-only.

Commit d236c97

Browse files
authored
Create 2477번 참외밭.java
1 parent b6bb14d commit d236c97

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package BOJ.boj2477;
2+
3+
import java.util.Scanner;
4+
5+
public class Main {
6+
public static void main(String[] args) {
7+
Scanner sc = new Scanner(System.in);
8+
9+
int k = sc.nextInt();
10+
11+
int[] dirs = new int[6];
12+
int[] dits = new int[6];
13+
int maxHeight = 0, maxWidth = 0;
14+
int heightIdx = -1, widthIdx = -1;
15+
16+
for (int i = 0; i < 6; i++) {
17+
dirs[i] = sc.nextInt();
18+
dits[i] = sc.nextInt();
19+
if (dirs[i] == 1 | dirs[i] == 2) {
20+
if (maxHeight < dits[i]) {
21+
maxHeight = dits[i];
22+
heightIdx = i;
23+
}
24+
} else {
25+
if (maxWidth < dits[i]) {
26+
maxWidth = dits[i];
27+
widthIdx = i;
28+
}
29+
}
30+
}
31+
int fullSquare = dits[heightIdx] * dits[widthIdx];
32+
int miniSquare = dits[(heightIdx + 3) % 6] * dits[(widthIdx + 3) % 6];
33+
34+
System.out.println((fullSquare-miniSquare)*k);
35+
}
36+
}

0 commit comments

Comments
 (0)