From cbcdaaf8d1cb12465627c0034499bc37ab7adbdb Mon Sep 17 00:00:00 2001 From: Jonghwan Lee <123362165+0224LJH@users.noreply.github.com> Date: Thu, 7 Aug 2025 22:02:49 +0900 Subject: [PATCH] =?UTF-8?q?[20250807]=20BOJ=20/=20G5=20/=204=EC=99=80=207?= =?UTF-8?q?=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 --- "0224LJH/202508/7 BOJ 4\354\231\200 7.md" | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 "0224LJH/202508/7 BOJ 4\354\231\200 7.md" diff --git "a/0224LJH/202508/7 BOJ 4\354\231\200 7.md" "b/0224LJH/202508/7 BOJ 4\354\231\200 7.md" new file mode 100644 index 00000000..1a036c5c --- /dev/null +++ "b/0224LJH/202508/7 BOJ 4\354\231\200 7.md" @@ -0,0 +1,53 @@ +```java +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.*; + + +public class Main { + + static int target; + static List list = new ArrayList<>(); + + + 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()); + } + + private static void process() throws IOException { + + int pos = 1; + + while ( target > 0){ + int pre = 1 << (pos-1); + int cur = 1 << pos; + + if ( (target&pre) != 0){ + target -= pre; + list.add(4); + }else{ + target -= cur; + list.add(7); + } + pos++; + + + } + } + + + private static void print() { + for (int i = list.size()-1; i >= 0; i--){ + System.out.print(list.get(i)); + } + } +} +``` \ No newline at end of file