結果

問題 No.756 チャンパーノウン定数 (1)
ユーザー cielciel
提出日時 2018-12-06 10:28:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 465 bytes
コンパイル時間 2,150 ms
コンパイル使用メモリ 72,596 KB
実行使用メモリ 56,072 KB
最終ジャッジ日時 2023-10-12 02:07:23
合計ジャッジ時間 6,348 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,664 KB
testcase_01 AC 123 ms
56,004 KB
testcase_02 AC 125 ms
56,052 KB
testcase_03 AC 123 ms
55,480 KB
testcase_04 AC 128 ms
56,032 KB
testcase_05 AC 127 ms
55,480 KB
testcase_06 AC 125 ms
55,740 KB
testcase_07 AC 124 ms
55,888 KB
testcase_08 AC 125 ms
55,664 KB
testcase_09 AC 125 ms
55,908 KB
testcase_10 AC 125 ms
56,072 KB
testcase_11 AC 125 ms
55,684 KB
testcase_12 AC 126 ms
55,664 KB
testcase_13 AC 127 ms
55,692 KB
testcase_14 AC 128 ms
55,848 KB
testcase_15 AC 126 ms
55,684 KB
testcase_16 AC 126 ms
55,616 KB
testcase_17 AC 126 ms
55,900 KB
testcase_18 AC 128 ms
55,920 KB
testcase_19 AC 129 ms
55,632 KB
testcase_20 AC 126 ms
55,976 KB
testcase_21 AC 126 ms
55,752 KB
testcase_22 AC 127 ms
55,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class Main{
	public static void main(String[]args){
		Scanner cin=new Scanner(System.in);
		long starting=1;
		int bse=10;
		for(;cin.hasNext();){
			long n=cin.nextLong();
			n+=starting-2;
			long digits=1;
			long expbase=1;
			long x;
			for(;(x=digits*expbase*(bse-1))<=n;n-=x){
				digits++;
				expbase*=bse;
			}
			long num=expbase+n/digits;
			long d=digits-1-n%digits;
			for(;d-->0;num/=bse);
			System.out.println(num%bse);
		}
	}
}
0