-
Notifications
You must be signed in to change notification settings - Fork 0
/
Q2477.java
47 lines (40 loc) · 1.21 KB
/
Q2477.java
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
37
38
39
40
41
42
43
44
45
46
47
package olympiad;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;
public class Q2477 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int times = Integer.parseInt(br.readLine());
int lines[] = new int[6];
int height = 0;
int heightIndex = 0;
int width = 0;
int widthIndex = 0;
for (int i = 0; i < 6; i++){
StringTokenizer st = new StringTokenizer(br.readLine());
Integer.parseInt(st.nextToken());
lines[i] = Integer.parseInt(st.nextToken());
if(i % 2 == 0){
if(height < lines[i]){
height = lines[i];
heightIndex = i;
}
} else {
if(width < lines[i]){
width = lines[i];
widthIndex = i;
}
}
}
int bigSquare = height * width;
int smallSquare = lines[(heightIndex + 3) % 6] * lines[(widthIndex + 3) % 6];
bw.write(((bigSquare - smallSquare) * times) + "\n");
br.close();
bw.close();
}
}