結果

問題 No.756 チャンパーノウン定数 (1)
ユーザー ciel
提出日時 2018-12-06 12:18:10
言語 PHP
(843.2)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 338 bytes
コンパイル時間 3,556 ms
コンパイル使用メモリ 30,520 KB
実行使用メモリ 31,544 KB
最終ジャッジ日時 2024-09-14 02:29:53
合計ジャッジ時間 5,351 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 6 WA * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

#!/usr/bin/php
<?php
$starting=1;
$bse=10;
while($s=fgets(STDIN)){
	$n=$s; // cannot intval
	$n+=$starting-2;
	$digits=1;
	$expbase=1;
	$x;
	while(($x=$digits*$expbase*($bse-1))<=$n){
		$n-=$x;
		$digits++;
		$expbase*=$bse;
	}
	$num=$expbase+$n/$digits;
	$d=$digits-1-$n%$digits;
	for(;$d--;){
		$num/=$bse;
	}
	echo $num%$bse.PHP_EOL;
}
0