結果

問題 No.499 7進数変換
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-17 01:47:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 161 ms / 1,000 ms
コード長 374 bytes
コンパイル時間 2,082 ms
コンパイル使用メモリ 74,400 KB
実行使用メモリ 57,268 KB
最終ジャッジ日時 2023-09-06 01:00:47
合計ジャッジ時間 8,445 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 161 ms
57,036 KB
testcase_01 AC 160 ms
56,876 KB
testcase_02 AC 155 ms
56,988 KB
testcase_03 AC 155 ms
57,268 KB
testcase_04 AC 157 ms
56,980 KB
testcase_05 AC 156 ms
56,688 KB
testcase_06 AC 158 ms
57,000 KB
testcase_07 AC 157 ms
56,792 KB
testcase_08 AC 156 ms
56,884 KB
testcase_09 AC 157 ms
56,664 KB
testcase_10 AC 154 ms
56,592 KB
testcase_11 AC 157 ms
56,916 KB
testcase_12 AC 160 ms
56,792 KB
testcase_13 AC 158 ms
57,056 KB
testcase_14 AC 158 ms
56,848 KB
testcase_15 AC 157 ms
56,860 KB
testcase_16 AC 159 ms
56,724 KB
testcase_17 AC 156 ms
56,964 KB
testcase_18 AC 156 ms
56,704 KB
testcase_19 AC 155 ms
56,860 KB
testcase_20 AC 158 ms
57,000 KB
testcase_21 AC 160 ms
57,152 KB
testcase_22 AC 160 ms
56,984 KB
testcase_23 AC 157 ms
56,852 KB
testcase_24 AC 155 ms
56,600 KB
testcase_25 AC 155 ms
56,888 KB
testcase_26 AC 155 ms
56,560 KB
testcase_27 AC 155 ms
56,560 KB
testcase_28 AC 155 ms
57,120 KB
testcase_29 AC 156 ms
56,772 KB
testcase_30 AC 156 ms
57,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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