結果

問題 No.757 チャンパーノウン定数 (2)
ユーザー chocoruskchocorusk
提出日時 2018-12-05 00:37:34
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 399 bytes
コンパイル時間 479 ms
コンパイル使用メモリ 86,748 KB
実行使用メモリ 78,968 KB
最終ジャッジ日時 2023-09-22 22:51:58
合計ジャッジ時間 8,229 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,120 KB
testcase_01 AC 72 ms
71,108 KB
testcase_02 AC 71 ms
71,048 KB
testcase_03 AC 70 ms
71,284 KB
testcase_04 AC 72 ms
71,320 KB
testcase_05 AC 72 ms
71,120 KB
testcase_06 AC 73 ms
71,284 KB
testcase_07 AC 72 ms
71,340 KB
testcase_08 AC 72 ms
71,108 KB
testcase_09 AC 71 ms
71,120 KB
testcase_10 AC 73 ms
71,148 KB
testcase_11 AC 73 ms
71,044 KB
testcase_12 AC 72 ms
71,260 KB
testcase_13 AC 72 ms
71,124 KB
testcase_14 AC 73 ms
71,144 KB
testcase_15 AC 72 ms
71,272 KB
testcase_16 AC 71 ms
70,932 KB
testcase_17 AC 71 ms
71,264 KB
testcase_18 AC 72 ms
71,252 KB
testcase_19 AC 71 ms
71,156 KB
testcase_20 AC 71 ms
71,016 KB
testcase_21 AC 70 ms
71,356 KB
testcase_22 AC 72 ms
71,352 KB
testcase_23 AC 73 ms
71,252 KB
testcase_24 AC 74 ms
71,308 KB
testcase_25 AC 72 ms
71,312 KB
testcase_26 AC 71 ms
71,340 KB
testcase_27 AC 71 ms
71,272 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 74 ms
71,332 KB
testcase_31 AC 77 ms
70,976 KB
testcase_32 AC 70 ms
71,416 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 AC 74 ms
71,384 KB
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 AC 104 ms
71,352 KB
testcase_43 AC 122 ms
70,968 KB
testcase_44 RE -
testcase_45 RE -
testcase_46 AC 106 ms
71,008 KB
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 AC 73 ms
71,328 KB
testcase_51 AC 72 ms
71,424 KB
testcase_52 AC 70 ms
71,120 KB
testcase_53 AC 72 ms
71,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
b=int(input())
s=input()
d=int(s, b)
if d<b:
  print(d)
  sys.exit()
n=len(s)
n1=1
n2=n
while n1!=n2:
  n0=(n1+n2+1)//2
  x=b
  if n0!=1:
    x=int('1'+('0'*n0), b)*n0-int('1'*n0, b)
  if x<d:
    n1=n0
  else:
    n2=n0-1
d=d-int('1'+('0'*n1), b)*n1+int('1'*n1, b)
p0=int('1'+('0'*n1), b)
i=n1+1
c=(d+i-1)//i
r=b
if d%i!=0:
  r=int('1'+('0'*(i-d%i+1)), b)
x=p0-1+c
x%=r;
print(x//(r//b))
0