From 79ba74e73dfb19f5d8494a2f78ae3431f4bed4ba Mon Sep 17 00:00:00 2001 From: suyeun84 <81475092+suyeun84@users.noreply.github.com> Date: Sun, 3 Aug 2025 14:11:51 +0900 Subject: [PATCH] =?UTF-8?q?[20250803]=20BOJ=20/=20G5=20/=204=EC=99=80=207?= =?UTF-8?q?=20/=20=EA=B9=80=EC=88=98=EC=97=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../202508/03 BOJ G5 4\354\231\200 7.md" | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 "suyeun84/202508/03 BOJ G5 4\354\231\200 7.md" diff --git "a/suyeun84/202508/03 BOJ G5 4\354\231\200 7.md" "b/suyeun84/202508/03 BOJ G5 4\354\231\200 7.md" new file mode 100644 index 00000000..927877c6 --- /dev/null +++ "b/suyeun84/202508/03 BOJ G5 4\354\231\200 7.md" @@ -0,0 +1,30 @@ +```java +import java.io.*; +import java.util.*; + +public class boj2877 { + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + static StringTokenizer st; + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static int nextInt() {return Integer.parseInt(st.nextToken());} + static StringBuilder sb = new StringBuilder(); + + public static void main(String[] args) throws Exception { + nextLine(); + int K = nextInt() + 1; + + int num = 0; + while(K != 0){ + num = K % 2; + sb.append(num); + K = K / 2; + } + StringBuilder result = new StringBuilder(); + for(int i = sb.toString().length() - 2; i >= 0; i--){ + if(sb.charAt(i) == '0') result.append(4); + else result.append(7); + } + System.out.println(result.toString()); + } +} +```