結果

問題 No.757 チャンパーノウン定数 (2)
ユーザー chocoruskchocorusk
提出日時 2018-12-05 00:36:44
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 388 bytes
コンパイル時間 931 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 79,984 KB
最終ジャッジ日時 2023-09-22 22:49:43
合計ジャッジ時間 7,885 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,096 KB
testcase_01 AC 71 ms
71,068 KB
testcase_02 AC 71 ms
71,260 KB
testcase_03 AC 71 ms
71,408 KB
testcase_04 AC 73 ms
71,268 KB
testcase_05 AC 70 ms
71,292 KB
testcase_06 AC 73 ms
70,968 KB
testcase_07 AC 73 ms
71,456 KB
testcase_08 AC 72 ms
71,336 KB
testcase_09 AC 72 ms
71,096 KB
testcase_10 AC 74 ms
71,272 KB
testcase_11 AC 72 ms
71,012 KB
testcase_12 AC 74 ms
71,092 KB
testcase_13 AC 72 ms
71,164 KB
testcase_14 AC 71 ms
71,244 KB
testcase_15 AC 71 ms
71,256 KB
testcase_16 AC 73 ms
71,008 KB
testcase_17 AC 73 ms
71,412 KB
testcase_18 AC 72 ms
71,212 KB
testcase_19 AC 73 ms
71,172 KB
testcase_20 AC 73 ms
71,092 KB
testcase_21 AC 71 ms
71,300 KB
testcase_22 AC 74 ms
71,172 KB
testcase_23 AC 72 ms
71,436 KB
testcase_24 AC 73 ms
71,320 KB
testcase_25 AC 73 ms
71,280 KB
testcase_26 AC 72 ms
71,116 KB
testcase_27 AC 73 ms
71,156 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 73 ms
71,184 KB
testcase_31 AC 73 ms
71,168 KB
testcase_32 AC 72 ms
71,164 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 AC 73 ms
71,280 KB
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 AC 106 ms
70,976 KB
testcase_43 AC 123 ms
71,180 KB
testcase_44 RE -
testcase_45 RE -
testcase_46 AC 107 ms
71,268 KB
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
testcase_51 RE -
testcase_52 AC 73 ms
71,172 KB
testcase_53 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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