import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Scanner;
public class Main {
public static int arr[][] = new int [21][3];
public static int k;
public static int fullarea = 0;
public static int cutarea = 0;
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
Scanner scan = new Scanner(System.in);
k = scan.nextInt();
int i, j;
int sero=0,garo=0;
int smallarea = 0;
for (i = 0; i < 6; i++) {
arr[i][0] = scan.nextInt();
arr[i][1] = scan.nextInt();
if (arr[i][0] == 1 || arr[i][0] == 2) {
garo = Math.max(garo, arr[i][1]);
}
else {
sero = Math.max(sero, arr[i][1]);
}
}
arr[6][0] = arr[0][0];
arr[6][1] = arr[0][1];
for (i = 0; i < 6; i++) {
if (arr[i][0] == 1 && arr[i + 1][0] == 3) {
smallarea = arr[i][1] * arr[i + 1][1];
}
if (arr[i][0] == 2 && arr[i + 1][0] == 4) {
smallarea = arr[i][1] * arr[i + 1][1];
}
if (arr[i][0] == 4 && arr[i + 1][0] == 1) {
smallarea = arr[i][1] * arr[i + 1][1];
}
if (arr[i][0] == 3 && arr[i + 1][0] == 2) {
smallarea = arr[i][1] * arr[i + 1][1];
}
}
System.out.printf("%d", (sero*garo - smallarea) * k);
}
}
http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=1520&sca=2060
'정올문제소스코드' 카테고리의 다른 글
1761 : 숫자 야구 (0) | 2021.10.29 |
---|---|
3427 : 볼 모으기(balls) (0) | 2021.10.29 |
1836 : 연속부분합 찾기 (0) | 2021.10.29 |
1761 : 숫자 야구 (0) | 2021.10.29 |
1031 : 빙고 (0) | 2021.10.29 |