結果
問題 | No.757 チャンパーノウン定数 (2) |
ユーザー |
|
提出日時 | 2018-12-02 02:46:42 |
言語 | Ruby (3.4.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 490 bytes |
コンパイル時間 | 41 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 80,796 KB |
最終ジャッジ日時 | 2024-06-27 13:34:10 |
合計ジャッジ時間 | 7,242 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 -- * 1 |
other | AC * 26 TLE * 1 -- * 24 |
コンパイルメッセージ
Syntax OK
ソースコード
#!/usr/bin/rubystarting=1bse=gets.to_iwhile getsn=$_.to_i(bse)n+=starting-2digits=1expbase=1if falsewhile (x=expbase*(digits*(bse-1)))<=ndigits+=1expbase*=bsen-=xendelsewhile digits*expbase*bse-(expbase*bse-1)/(bse-1)<=ndigits+=1expbase*=bseendn-=(digits-1)*expbase-(expbase-1)/(bse-1)endnum=expbase+n/digitsif falsed=digits-1-n%digitsd.times{num/=bse}puts num%bseelseputs num.to_s(bse)[-(digits-1-n%digits)-1]endend