From 53cd5e45a094135b10022c5e82903109683a7f28 Mon Sep 17 00:00:00 2001 From: Ukj0ng <90972240+Ukj0ng@users.noreply.github.com> Date: Wed, 4 Feb 2026 12:33:24 +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=ED=95=9C=EC=A2=85=EC=9A=B1?= 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" | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 "Ukj0ng/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/Ukj0ng/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/Ukj0ng/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..7a105440 --- /dev/null +++ "b/Ukj0ng/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,59 @@ +``` +import java.io.*; +import java.util.StringTokenizer; + +public class Main { + private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + private static final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + private static int[] arr; + private static boolean[] visited; + private static int N, X, Y, answer; + + public static void main(String[] args) throws IOException { + init(); + arr[X] = Y-X-1; + arr[Y] = Y-X-1; + visited[Y-X-1] = true; + make(1); + + bw.write(answer + "\n"); + bw.flush(); + bw.close(); + br.close(); + } + + private static void init() throws IOException { + 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]; + visited = new boolean[N+1]; + } + + private static void make(int index) { + if (index == 2*N+1) { + answer++; + return; + } + + if (arr[index] != 0) make(index+1); + else { + for (int i = 1; i <= N; i++) { + if (!visited[i]) { + if (index+i+1 <= 2*N && arr[index+i+1] == 0) { + arr[index] = i; + arr[index+i+1] = i; + visited[i] = true; + make(index+1); + visited[i] = false; + arr[index] = 0; + arr[index+i+1] = 0; + } + } + } + } + } +} +```