File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ ``` java
2+ import java.io.* ;
3+ import java.util.* ;
4+
5+ public class boj2877 {
6+ static BufferedReader br = new BufferedReader (new InputStreamReader (System . in));
7+ static StringTokenizer st;
8+ static void nextLine () throws Exception {st = new StringTokenizer (br .readLine ());}
9+ static int nextInt() {return Integer . parseInt(st. nextToken());}
10+ static StringBuilder sb = new StringBuilder ();
11+
12+ public static void main(String [] args) throws Exception {
13+ nextLine();
14+ int K = nextInt() + 1 ;
15+
16+ int num = 0 ;
17+ while (K != 0 ){
18+ num = K % 2 ;
19+ sb. append(num);
20+ K = K / 2 ;
21+ }
22+ StringBuilder result = new StringBuilder ();
23+ for (int i = sb. toString(). length() - 2 ; i >= 0 ; i-- ){
24+ if (sb. charAt(i) == ' 0' ) result. append(4 );
25+ else result. append(7 );
26+ }
27+ System . out. println(result. toString());
28+ }
29+ }
30+ ```
You can’t perform that action at this time.
0 commit comments