結果

問題 No.499 7進数変換
ユーザー syuki791syuki791
提出日時 2017-07-02 15:13:01
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 502 bytes
コンパイル時間 2,598 ms
コンパイル使用メモリ 76,020 KB
実行使用メモリ 54,632 KB
最終ジャッジ日時 2024-04-15 12:02:06
合計ジャッジ時間 8,318 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 136 ms
54,072 KB
testcase_08 AC 137 ms
54,360 KB
testcase_09 AC 136 ms
54,264 KB
testcase_10 AC 137 ms
53,868 KB
testcase_11 AC 141 ms
54,632 KB
testcase_12 AC 135 ms
54,324 KB
testcase_13 AC 136 ms
54,104 KB
testcase_14 AC 133 ms
53,956 KB
testcase_15 AC 132 ms
53,964 KB
testcase_16 AC 139 ms
54,168 KB
testcase_17 AC 135 ms
54,008 KB
testcase_18 AC 137 ms
54,292 KB
testcase_19 AC 132 ms
54,268 KB
testcase_20 AC 135 ms
53,964 KB
testcase_21 AC 138 ms
54,212 KB
testcase_22 AC 139 ms
54,108 KB
testcase_23 AC 136 ms
54,268 KB
testcase_24 AC 136 ms
54,196 KB
testcase_25 AC 134 ms
54,324 KB
testcase_26 AC 136 ms
53,956 KB
testcase_27 AC 136 ms
54,232 KB
testcase_28 AC 136 ms
53,988 KB
testcase_29 AC 136 ms
54,352 KB
testcase_30 AC 139 ms
54,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.Stack;

public class Main {
	
	public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		String str = s.next();
		s.close();
		
		long l = Long.parseLong(str);
		long ltmp = l;
		Stack<Long> stack = new Stack<Long>();
		
		while(true){			
			stack.push(ltmp%7);
			if(ltmp/7 < 7){
				stack.push(ltmp/7);
				break;
			}
			ltmp = ltmp/7;
		}
		while(!stack.empty()){
			System.out.print(stack.pop());
		}
		System.out.println("");
	}

}
0