結果

問題 No.499 7進数変換
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-05-04 07:58:44
言語 Java21
(openjdk 21)
結果
AC  
実行時間 42 ms / 1,000 ms
コード長 690 bytes
コンパイル時間 1,907 ms
コンパイル使用メモリ 72,672 KB
実行使用メモリ 49,860 KB
最終ジャッジ日時 2023-10-12 06:08:01
合計ジャッジ時間 4,356 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
49,248 KB
testcase_01 AC 41 ms
49,428 KB
testcase_02 AC 41 ms
49,340 KB
testcase_03 AC 40 ms
49,260 KB
testcase_04 AC 42 ms
49,424 KB
testcase_05 AC 41 ms
49,464 KB
testcase_06 AC 40 ms
49,472 KB
testcase_07 AC 42 ms
49,220 KB
testcase_08 AC 41 ms
49,128 KB
testcase_09 AC 40 ms
49,232 KB
testcase_10 AC 40 ms
49,220 KB
testcase_11 AC 41 ms
49,208 KB
testcase_12 AC 41 ms
49,436 KB
testcase_13 AC 41 ms
49,172 KB
testcase_14 AC 41 ms
49,212 KB
testcase_15 AC 40 ms
49,368 KB
testcase_16 AC 41 ms
49,136 KB
testcase_17 AC 41 ms
49,332 KB
testcase_18 AC 41 ms
49,216 KB
testcase_19 AC 40 ms
49,240 KB
testcase_20 AC 41 ms
49,304 KB
testcase_21 AC 40 ms
49,412 KB
testcase_22 AC 40 ms
49,316 KB
testcase_23 AC 41 ms
49,272 KB
testcase_24 AC 41 ms
49,216 KB
testcase_25 AC 41 ms
49,860 KB
testcase_26 AC 40 ms
49,260 KB
testcase_27 AC 41 ms
49,444 KB
testcase_28 AC 41 ms
47,300 KB
testcase_29 AC 41 ms
49,468 KB
testcase_30 AC 40 ms
49,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.System.in;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        long N = Long.parseLong(reader.readLine());
        System.out.println(toSeptenaryString(N));
    }

    private static String toSeptenaryString(long l) {
        StringBuilder s = new StringBuilder();
        if(l ==0) {
            return "0";
        }
        while (l != 0) {
            s.append(l % 7);
            l = l / 7;
        }
        return s.reverse().toString();
    }
}
0