From 3c84d440c3e4fa46496e7f05502a4de0e8f32dd5 Mon Sep 17 00:00:00 2001 From: JHLEE325 <82587652+JHLEE325@users.noreply.github.com> Date: Tue, 3 Feb 2026 16:53:59 +0900 Subject: [PATCH] =?UTF-8?q?[20260203]=20BOJ=20/=20G5=20/=20=EB=9E=AD?= =?UTF-8?q?=ED=8D=BC=EB=93=A0=20=EC=88=98=EC=97=B4=EC=9F=81=EC=9D=B4?= =?UTF-8?q?=EC=95=BC!!=20/=20=EC=9D=B4=EC=A4=80=ED=9D=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\354\237\201\354\235\264\354\225\274!!.md" | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 "JHLEE325/202602/03 BOJ G5 \353\236\255\355\215\274\353\223\240 \354\210\230\354\227\264\354\237\201\354\235\264\354\225\274!!.md" diff --git "a/JHLEE325/202602/03 BOJ G5 \353\236\255\355\215\274\353\223\240 \354\210\230\354\227\264\354\237\201\354\235\264\354\225\274!!.md" "b/JHLEE325/202602/03 BOJ G5 \353\236\255\355\215\274\353\223\240 \354\210\230\354\227\264\354\237\201\354\235\264\354\225\274!!.md" new file mode 100644 index 00000000..2faa47c7 --- /dev/null +++ "b/JHLEE325/202602/03 BOJ G5 \353\236\255\355\215\274\353\223\240 \354\210\230\354\227\264\354\237\201\354\235\264\354\225\274!!.md" @@ -0,0 +1,57 @@ +```java +import java.io.*; +import java.util.*; + +public class Main { + + static int n, x, y, count; + static int[] arr; + static boolean[] used; + + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = new StringTokenizer(br.readLine()); + + n = Integer.parseInt(st.nextToken()); + x = Integer.parseInt(st.nextToken()); + y = Integer.parseInt(st.nextToken()); + + arr = new int[2 * n + 1]; + used = new boolean[n + 1]; + + int fixedNum = y - x - 1; + arr[x] = arr[y] = fixedNum; + used[fixedNum] = true; + + check(1); + + System.out.println(count); + } + + static void check(int pos) { + if (pos == 2 * n + 1) { + count++; + return; + } + + if (arr[pos] != 0) { + check(pos + 1); + return; + } + + for (int i = 1; i <= n; i++) { + if (used[i]) continue; + + if (pos + i + 1 <= 2 * n && arr[pos + i + 1] == 0) { + arr[pos] = arr[pos + i + 1] = i; + used[i] = true; + + check(pos + 1); + + arr[pos] = arr[pos + i + 1] = 0; + used[i] = false; + } + } + } +} +```