結果

問題 No.499 7進数変換
ユーザー tentententen
提出日時 2020-09-10 10:06:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 1,000 ms
コード長 391 bytes
コンパイル時間 2,434 ms
コンパイル使用メモリ 71,508 KB
実行使用メモリ 56,300 KB
最終ジャッジ日時 2023-08-23 13:07:23
合計ジャッジ時間 7,239 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,824 KB
testcase_01 AC 118 ms
56,080 KB
testcase_02 AC 119 ms
56,020 KB
testcase_03 AC 121 ms
56,204 KB
testcase_04 AC 124 ms
55,424 KB
testcase_05 AC 121 ms
56,300 KB
testcase_06 AC 120 ms
56,124 KB
testcase_07 AC 122 ms
55,424 KB
testcase_08 AC 122 ms
55,768 KB
testcase_09 AC 120 ms
55,804 KB
testcase_10 AC 120 ms
55,684 KB
testcase_11 AC 119 ms
55,900 KB
testcase_12 AC 119 ms
56,288 KB
testcase_13 AC 119 ms
55,368 KB
testcase_14 AC 119 ms
56,052 KB
testcase_15 AC 119 ms
55,884 KB
testcase_16 AC 120 ms
56,060 KB
testcase_17 AC 120 ms
55,684 KB
testcase_18 AC 121 ms
56,196 KB
testcase_19 AC 120 ms
55,864 KB
testcase_20 AC 120 ms
56,164 KB
testcase_21 AC 119 ms
55,692 KB
testcase_22 AC 123 ms
55,784 KB
testcase_23 AC 119 ms
55,956 KB
testcase_24 AC 118 ms
55,716 KB
testcase_25 AC 118 ms
55,640 KB
testcase_26 AC 119 ms
55,916 KB
testcase_27 AC 119 ms
55,840 KB
testcase_28 AC 121 ms
55,800 KB
testcase_29 AC 122 ms
55,608 KB
testcase_30 AC 120 ms
55,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt();
    	if (n == 0) {
    	    System.out.println(0);
    	    return;
    	}
    	StringBuilder sb = new StringBuilder();
    	while (n > 0) {
    	    sb.append(n % 7);
    	    n /= 7;
    	}
    	System.out.println(sb.reverse());
    }
}
0