結果

問題 No.757 チャンパーノウン定数 (2)
ユーザー pekempeypekempey
提出日時 2018-12-05 00:00:29
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 270 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 10,520 KB
実行使用メモリ 8,368 KB
最終ジャッジ日時 2023-09-22 21:09:39
合計ジャッジ時間 3,463 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
7,728 KB
testcase_01 AC 17 ms
7,704 KB
testcase_02 AC 18 ms
7,720 KB
testcase_03 AC 17 ms
7,816 KB
testcase_04 AC 20 ms
7,848 KB
testcase_05 AC 20 ms
7,808 KB
testcase_06 AC 21 ms
8,232 KB
testcase_07 AC 17 ms
7,752 KB
testcase_08 AC 22 ms
8,096 KB
testcase_09 AC 22 ms
8,156 KB
testcase_10 AC 16 ms
7,708 KB
testcase_11 AC 17 ms
7,708 KB
testcase_12 AC 17 ms
7,816 KB
testcase_13 AC 20 ms
7,768 KB
testcase_14 AC 23 ms
7,772 KB
testcase_15 AC 21 ms
8,128 KB
testcase_16 AC 17 ms
7,756 KB
testcase_17 AC 23 ms
8,080 KB
testcase_18 AC 22 ms
8,156 KB
testcase_19 AC 16 ms
7,812 KB
testcase_20 AC 17 ms
7,788 KB
testcase_21 AC 16 ms
7,828 KB
testcase_22 AC 21 ms
7,812 KB
testcase_23 AC 21 ms
7,840 KB
testcase_24 AC 21 ms
8,060 KB
testcase_25 AC 17 ms
7,728 KB
testcase_26 AC 23 ms
8,116 KB
testcase_27 AC 23 ms
8,084 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 24 ms
8,228 KB
testcase_31 AC 20 ms
7,760 KB
testcase_32 AC 22 ms
8,232 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 AC 19 ms
7,812 KB
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 AC 31 ms
8,288 KB
testcase_43 AC 92 ms
8,336 KB
testcase_44 RE -
testcase_45 RE -
testcase_46 AC 43 ms
8,292 KB
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 AC 23 ms
8,092 KB
testcase_51 AC 21 ms
8,092 KB
testcase_52 AC 17 ms
7,820 KB
testcase_53 AC 16 ms
7,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

B = int(input())
D = int(input(), base=B) - 1

def f(k):
  return (B**k-1-(B-1)*B**k*k)//(1-B)

l = 0
r = 100000
while r - l > 1:
  m = (l + r) // 2
  if D >= f(m):
    l = m
  else:
    r = m
D -= f(l)

a, b = D // r + B**(r - 1), D % r

print(a // B**(r - 1 - b) % B)
0