結果

問題 No.756 チャンパーノウン定数 (1)
ユーザー cielciel
提出日時 2018-12-06 12:13:31
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 1,191 bytes
コンパイル時間 66 ms
コンパイル使用メモリ 6,816 KB
実行使用メモリ 41,684 KB
最終ジャッジ日時 2024-04-21 02:25:49
合計ジャッジ時間 2,367 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
39,552 KB
testcase_01 AC 70 ms
41,300 KB
testcase_02 AC 66 ms
41,556 KB
testcase_03 AC 66 ms
41,292 KB
testcase_04 AC 66 ms
39,552 KB
testcase_05 AC 66 ms
39,296 KB
testcase_06 AC 67 ms
41,684 KB
testcase_07 AC 66 ms
39,168 KB
testcase_08 AC 74 ms
41,424 KB
testcase_09 AC 71 ms
40,192 KB
testcase_10 AC 66 ms
41,324 KB
testcase_11 AC 69 ms
41,292 KB
testcase_12 AC 65 ms
39,552 KB
testcase_13 AC 65 ms
40,448 KB
testcase_14 AC 67 ms
40,192 KB
testcase_15 AC 67 ms
41,680 KB
testcase_16 AC 68 ms
41,300 KB
testcase_17 AC 67 ms
39,552 KB
testcase_18 AC 76 ms
41,580 KB
testcase_19 AC 66 ms
40,064 KB
testcase_20 AC 65 ms
40,064 KB
testcase_21 AC 67 ms
40,064 KB
testcase_22 AC 65 ms
40,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//usr/bin/env node $0 $@;exit
var main=function(){
	var starting=1;
	var bse=10;
	for(;;){
		var n=Number(readline())
		if(!n)break;
		n+=starting-2
		var digits=1
		var expbase=1
		var x=bse-1
		while(x<=n){
			n-=x
			digits+=1
			expbase*=bse
			x=digits*expbase*(bse-1)
		}
		var num=expbase+(n/digits)^0
		var d=digits-1-n%digits
		for(;d--;){
			num=num/bse^0
		}
		print(num%bse)
	}
};

/// IO ///
if(typeof process!=='undefined'){
	//node.js
	var print=function(x){
		console.log(x);
	}
	var readline=(function(){
		var T=[],cnt=0;
		var stdin = process.openStdin();
		stdin.setEncoding('utf8');

		var input_fragment="";
		stdin.on('data', function(input) {
			var ref=(input_fragment+input).split("\n");
			input_fragment=ref.pop();
			for(var i=0;i<ref.length;i++){
				if(ref[i]=='')continue;
				T.push(ref[i]);
			}
		});
		stdin.on('end', function(z) {
			if(input_fragment){
				var ref=(input_fragment+"\n").split("\n");
				input_fragment=ref.pop();
				for(var i=0;i<ref.length;i++){
					if(ref[i]=='')continue;
					T.push(ref[i]);
				}
			}
			main();
		});

		return function(){
			if(T.length<=cnt)return null;
			return T[cnt++];
		};
	})();
}else{
	//v8
	main();
}
0