結果

問題 No.757 チャンパーノウン定数 (2)
ユーザー chocoruskchocorusk
提出日時 2018-12-05 01:36:28
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 362 bytes
コンパイル時間 325 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 79,508 KB
最終ジャッジ日時 2023-09-23 00:44:04
合計ジャッジ時間 7,835 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,084 KB
testcase_01 AC 71 ms
71,488 KB
testcase_02 AC 68 ms
71,284 KB
testcase_03 AC 77 ms
71,560 KB
testcase_04 AC 71 ms
71,228 KB
testcase_05 AC 72 ms
71,364 KB
testcase_06 AC 72 ms
71,552 KB
testcase_07 AC 73 ms
71,356 KB
testcase_08 AC 71 ms
71,432 KB
testcase_09 AC 72 ms
71,424 KB
testcase_10 AC 70 ms
71,464 KB
testcase_11 AC 71 ms
71,256 KB
testcase_12 AC 71 ms
71,276 KB
testcase_13 AC 71 ms
71,484 KB
testcase_14 AC 70 ms
71,436 KB
testcase_15 AC 71 ms
71,280 KB
testcase_16 AC 72 ms
71,388 KB
testcase_17 AC 73 ms
71,136 KB
testcase_18 AC 72 ms
71,412 KB
testcase_19 AC 71 ms
71,484 KB
testcase_20 AC 69 ms
71,616 KB
testcase_21 AC 72 ms
71,436 KB
testcase_22 AC 72 ms
71,432 KB
testcase_23 AC 70 ms
71,200 KB
testcase_24 AC 70 ms
71,392 KB
testcase_25 AC 72 ms
71,292 KB
testcase_26 AC 72 ms
71,360 KB
testcase_27 AC 71 ms
71,264 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 75 ms
71,508 KB
testcase_31 AC 72 ms
71,328 KB
testcase_32 AC 71 ms
71,416 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 AC 71 ms
71,128 KB
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 AC 108 ms
71,256 KB
testcase_43 AC 122 ms
71,648 KB
testcase_44 RE -
testcase_45 RE -
testcase_46 AC 106 ms
71,608 KB
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 AC 71 ms
71,328 KB
testcase_51 AC 72 ms
71,328 KB
testcase_52 AC 72 ms
71,288 KB
testcase_53 AC 72 ms
71,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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