結果

問題 No.1862 Copy and Paste
ユーザー ChipppppChippppp
提出日時 2021-12-24 02:08:10
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 513 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 56,188 KB
最終ジャッジ日時 2024-04-26 18:32:10
合計ジャッジ時間 2,495 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,224 KB
testcase_01 WA -
testcase_02 AC 37 ms
52,224 KB
testcase_03 AC 38 ms
52,608 KB
testcase_04 AC 37 ms
51,712 KB
testcase_05 AC 36 ms
52,224 KB
testcase_06 AC 36 ms
52,352 KB
testcase_07 WA -
testcase_08 AC 36 ms
52,096 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 40 ms
54,528 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 37 ms
54,272 KB
testcase_16 AC 37 ms
54,528 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 39 ms
54,400 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 39 ms
54,016 KB
testcase_23 AC 39 ms
54,144 KB
testcase_24 AC 40 ms
54,784 KB
testcase_25 WA -
testcase_26 AC 39 ms
54,272 KB
testcase_27 AC 40 ms
54,272 KB
testcase_28 AC 39 ms
54,272 KB
testcase_29 WA -
testcase_30 AC 39 ms
53,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  from math import inf
  a, b = map(int, input().split())
  n = int(input())
  if n == 1:
    exit(print(1))
  ans = inf
  for i in range(1, n + 1):
    ng, ok = 1, n + 1
    while ok - ng > 1:
      mid = (ng + ok) // 2
      if mid ** i >= n:
        ok = mid
      else:
        ng = mid
    tmp = ok ** (i - 1)
    p = (n + tmp - 1) // tmp
    ans = min(ans, (a + b * (ok - 1)) * (i - 1) + (a + b * (p - 1) if p else 0))
    if ok == 2:
      break
  print(ans)
if __name__ == '__main__':
  main()
0