From 0631a8a7246c21a3ece59e761300284304f16440 Mon Sep 17 00:00:00 2001 From: Jonghwan Lee <123362165+0224LJH@users.noreply.github.com> Date: Tue, 12 Aug 2025 19:23:22 +0900 Subject: [PATCH] =?UTF-8?q?[20250812]=20BOJ=20/=20G3=20/=20=ED=95=98?= =?UTF-8?q?=EB=85=B8=EC=9D=B4=20=ED=83=91=20=EC=9D=B4=EB=8F=99=20=EC=88=9C?= =?UTF-8?q?=EC=84=9C=20/=20=EC=9D=B4=EC=A2=85=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4\353\217\231 \354\210\234\354\204\234.md" | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 "0224LJH/202508/12 BOJ \355\225\230\353\205\270\354\235\264 \355\203\221 \354\235\264\353\217\231 \354\210\234\354\204\234.md" diff --git "a/0224LJH/202508/12 BOJ \355\225\230\353\205\270\354\235\264 \355\203\221 \354\235\264\353\217\231 \354\210\234\354\204\234.md" "b/0224LJH/202508/12 BOJ \355\225\230\353\205\270\354\235\264 \355\203\221 \354\235\264\353\217\231 \354\210\234\354\204\234.md" new file mode 100644 index 00000000..a2987189 --- /dev/null +++ "b/0224LJH/202508/12 BOJ \355\225\230\353\205\270\354\235\264 \355\203\221 \354\235\264\353\217\231 \354\210\234\354\204\234.md" @@ -0,0 +1,48 @@ +```java + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.*; + + +public class Main { + static StringBuilder sb = new StringBuilder(); + static int target,cnt; + + public static void main(String[] args) throws IOException { + init(); + process(); + print(); + } + + private static void init() throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + target = Integer.parseInt(br.readLine()); + cnt = 0 ; + } + + private static void process() throws IOException { + move (1,3,2,target); + } + + private static void move(int from, int to, int mid,int size) { + if ( size == 1){ + cnt++; + sb.append(from).append(" ").append(to).append("\n"); + return; + } + + cnt++; + move(from, mid , to, size - 1); + sb.append(from).append(" ").append(to).append("\n"); + move(mid, to , from, size - 1); + } + + + private static void print() { + System.out.println(cnt); + System.out.println(sb.toString()); + } +} +``` \ No newline at end of file