結果

問題 No.499 7進数変換
ユーザー Amanita2016Amanita2016
提出日時 2017-07-07 00:52:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 1,000 ms
コード長 628 bytes
コンパイル時間 2,699 ms
コンパイル使用メモリ 76,312 KB
実行使用メモリ 41,620 KB
最終ジャッジ日時 2024-04-15 22:06:08
合計ジャッジ時間 7,021 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
41,392 KB
testcase_01 AC 131 ms
41,508 KB
testcase_02 AC 132 ms
41,308 KB
testcase_03 AC 130 ms
41,172 KB
testcase_04 AC 129 ms
41,272 KB
testcase_05 AC 130 ms
41,292 KB
testcase_06 AC 126 ms
41,332 KB
testcase_07 AC 115 ms
40,124 KB
testcase_08 AC 133 ms
41,460 KB
testcase_09 AC 116 ms
39,992 KB
testcase_10 AC 117 ms
39,880 KB
testcase_11 AC 128 ms
41,420 KB
testcase_12 AC 113 ms
40,116 KB
testcase_13 AC 112 ms
40,248 KB
testcase_14 AC 122 ms
41,064 KB
testcase_15 AC 126 ms
41,304 KB
testcase_16 AC 115 ms
40,220 KB
testcase_17 AC 131 ms
41,304 KB
testcase_18 AC 123 ms
41,024 KB
testcase_19 AC 116 ms
39,840 KB
testcase_20 AC 128 ms
41,460 KB
testcase_21 AC 126 ms
41,184 KB
testcase_22 AC 129 ms
41,168 KB
testcase_23 AC 116 ms
40,164 KB
testcase_24 AC 130 ms
41,036 KB
testcase_25 AC 112 ms
40,120 KB
testcase_26 AC 130 ms
41,620 KB
testcase_27 AC 127 ms
41,028 KB
testcase_28 AC 115 ms
40,560 KB
testcase_29 AC 112 ms
40,216 KB
testcase_30 AC 126 ms
40,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int dec = sc.nextInt();
		String sep = "";
		int num = 7;
		int power = num;
		while(true){
			int work = dec / power;
			if(work <= 0){
				break;
			}
			power *= num;
			
		}
		while((power /= num) > 0){
			for(int i = 1 ; i <= num ; i++){
				int work = dec / (power*i);
				if(work <= 0){
					sep += Integer.toString(i-1);
					if(i != 1){
						dec %= (power*(i-1));
					}
					break;
				}
			}
		}
		System.out.println(sep);
	}

}
0