結果

問題 No.499 7進数変換
コンテスト
ユーザー Amanita2016
提出日時 2017-07-07 00:52:42
言語 Java
(openjdk 26.0.2.1 + ACL)
コンパイル:
javac -J-Duser.language=en -encoding UTF8 -cp /opt/aclib/ac_library.jar _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true -cp .:/opt/aclib/ac_library.jar _class_
結果
AC  
実行時間 57 ms / 1,000 ms
+ 310µs
コード長 628 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,454 ms
コンパイル使用メモリ 87,724 KB
実行使用メモリ 42,752 KB
最終ジャッジ日時 2026-09-10 22:41:56
合計ジャッジ時間 5,021 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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