結果

問題 No.499 7進数変換
ユーザー takeya_okinotakeya_okino
提出日時 2017-06-19 22:57:51
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 1,000 ms
コード長 398 bytes
コンパイル時間 2,159 ms
コンパイル使用メモリ 76,204 KB
実行使用メモリ 52,584 KB
最終ジャッジ日時 2024-04-10 06:17:06
合計ジャッジ時間 7,080 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
41,480 KB
testcase_01 AC 127 ms
41,724 KB
testcase_02 AC 117 ms
40,316 KB
testcase_03 AC 135 ms
41,720 KB
testcase_04 AC 127 ms
41,352 KB
testcase_05 AC 134 ms
52,584 KB
testcase_06 AC 114 ms
40,224 KB
testcase_07 AC 129 ms
41,288 KB
testcase_08 AC 127 ms
41,728 KB
testcase_09 AC 127 ms
41,692 KB
testcase_10 AC 125 ms
41,544 KB
testcase_11 AC 126 ms
41,464 KB
testcase_12 AC 126 ms
41,416 KB
testcase_13 AC 119 ms
41,472 KB
testcase_14 AC 123 ms
41,236 KB
testcase_15 AC 123 ms
41,320 KB
testcase_16 AC 110 ms
40,316 KB
testcase_17 AC 123 ms
41,156 KB
testcase_18 AC 113 ms
40,132 KB
testcase_19 AC 111 ms
40,204 KB
testcase_20 AC 124 ms
41,348 KB
testcase_21 AC 122 ms
41,448 KB
testcase_22 AC 129 ms
41,664 KB
testcase_23 AC 127 ms
41,544 KB
testcase_24 AC 113 ms
51,044 KB
testcase_25 AC 116 ms
41,288 KB
testcase_26 AC 120 ms
41,276 KB
testcase_27 AC 123 ms
41,648 KB
testcase_28 AC 121 ms
41,516 KB
testcase_29 AC 122 ms
41,216 KB
testcase_30 AC 127 ms
41,648 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);
    } else {
      String ans = "";
      while(N > 0) {
        int r = N % 7;
        ans = String.valueOf(r) + ans;
        N -= r;
        N /= 7;
      }
      System.out.println(ans);
    }
  }
}
0