結果

問題 No.1862 Copy and Paste
ユーザー Chippppp
提出日時 2022-02-24 23:27:21
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 490 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-02 14:15:13
合計ジャッジ時間 2,073 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 26 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

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