結果
問題 |
No.757 チャンパーノウン定数 (2)
|
ユーザー |
![]() |
提出日時 | 2018-12-04 23:17:13 |
言語 | PyPy2 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 316 bytes |
コンパイル時間 | 484 ms |
コンパイル使用メモリ | 76,580 KB |
実行使用メモリ | 92,620 KB |
最終ジャッジ日時 | 2024-07-08 10:38:35 |
合計ジャッジ時間 | 9,657 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 -- * 1 |
other | AC * 7 WA * 19 TLE * 1 -- * 24 |
ソースコード
def Sn(n,b): bn = b**n return n*bn - (bn-1)/(b-1) B=int(raw_input()) C=raw_input().strip() D=0 for c in C: D=D*B+(ord(c)-ord('0')) D-=1 L=0 for i in range(20,-1,-1): if Sn(L+(1<<i),B)<=D: L += 1<<i D -= Sn(L,B) L += 1 mo = D % L D = (B**(L-1)) + D/L S="" while D>0: S += str(D%B) D /= B print S[-mo]