From 55455115141edf34486173ba634ca7ce7ac8e97d Mon Sep 17 00:00:00 2001 From: LiiNi-coder <97495437+LiiNi-coder@users.noreply.github.com> Date: Sat, 11 Oct 2025 23:59:29 +0900 Subject: [PATCH] =?UTF-8?q?[20251011]=20BOJ=20/=20G5=20/=20=EC=A3=BC?= =?UTF-8?q?=EC=82=AC=EC=9C=84=20/=20=EC=9D=B4=EC=9D=B8=ED=9D=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...J \354\243\274\354\202\254\354\234\204.md" | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 "LiiNi-coder/202510/11 BOJ \354\243\274\354\202\254\354\234\204.md" diff --git "a/LiiNi-coder/202510/11 BOJ \354\243\274\354\202\254\354\234\204.md" "b/LiiNi-coder/202510/11 BOJ \354\243\274\354\202\254\354\234\204.md" new file mode 100644 index 00000000..13aea61d --- /dev/null +++ "b/LiiNi-coder/202510/11 BOJ \354\243\274\354\202\254\354\234\204.md" @@ -0,0 +1,97 @@ +```java +import java.io.*; +import java.util.*; + +public class Main { + private static int N; + private static int[][] exposures3 = { + {0, 1, 2}, + {0, 1, 3}, + {0, 3, 4}, + {0, 4, 2}, + {1, 2, 5}, + {1, 3, 5}, + {1, 0, 3}, + {1, 0, 2}, + {2, 1, 5}, + {2, 0, 1}, + {2, 0, 4}, + {2, 4, 5}, + {3, 0, 1}, + {3, 5, 1}, + {3, 4, 5}, + {3, 4, 0}, + {4, 2, 0}, + {4, 3, 0}, + {4, 3, 5}, + {4, 5, 2} + }; + private static int[][] exposures2 = { + {0, 1}, + {0, 2}, + {0, 3}, + {0, 4}, + {1, 0}, + {1, 2}, + {1, 5}, + {1, 3}, + {2, 0}, + {2, 1}, + {2, 5}, + {2, 4}, + {3, 0}, + {3, 1}, + {3, 5}, + {3, 4}, + {4, 0}, + {4, 2}, + {4, 3}, + {4, 5}, + {5, 1}, + {5, 2}, + {5, 3}, + {5, 4} + }; + private static int[] Eyes; + + public static void main(String[] args)throws IOException { + BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); + N = Integer.parseInt(br.readLine()); + Eyes = new int[6]; + StringTokenizer st = new StringTokenizer(br.readLine()); + for(int i = 0; i < 6; i++) { + Eyes[i] = Integer.parseInt(st.nextToken()); + } + + if(N == 1){ + System.out.println(Arrays.stream(Eyes).sum() - Arrays.stream(Eyes).max().getAsInt()); + return; + } + + int min3 = Integer.MAX_VALUE; + int min2 = Integer.MAX_VALUE; + int min1 = Arrays.stream(Eyes).min().getAsInt(); + + for(int[] exposure2 : exposures2) { + int temp = 0; + for(int i : exposure2) temp += Eyes[i]; + min2 = Math.min(temp, min2); + } + + for(int[] exposure3 : exposures3) { + int temp = 0; + for(int i : exposure3) temp += Eyes[i]; + min3 = Math.min(temp, min3); + } + + long nExposure3 = 4; + long nExposure2 = (N - 2) * 8 + 4; + long nExposure1 = (long)(N - 2) * (N - 2) + (long)(N - 2) * 4 * (N - 1); + + long answer = min3 * nExposure3 + min2 * nExposure2 + min1 * nExposure1; + System.out.println(answer); + br.close(); + } +} + +```