結果

問題 No.499 7進数変換
ユーザー Amanita2016
提出日時 2017-07-07 00:32:52
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 754 bytes
コンパイル時間 2,763 ms
コンパイル使用メモリ 76,324 KB
実行使用メモリ 57,376 KB
最終ジャッジ日時 2024-10-06 03:56:14
合計ジャッジ時間 8,681 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 31
権限があれば一括ダウンロードができます

ソースコード

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){
			while(true){
				int work = dec / power;
				if(work <= 0){
					power /= num;
					break;
				}
				power *= num;
				
			}
			for(int i = 1 ; i <= num ; i++){
				int work = dec / (power*i);
				System.out.println(dec+" "+ work);
				if(work <= 0){
					sep += Integer.toString(i-1);
					if(i != 1){
						dec %= (power*(i-1));
					}
					break;
				}
			}
			if(dec < num){
				sep += Integer.toString(dec);
				break;
			}
		}
		System.out.println(sep);
	}

}
0