結果
問題 |
No.555 世界史のレポート
|
ユーザー |
![]() |
提出日時 | 2020-03-17 02:20:36 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 694 bytes |
コンパイル時間 | 241 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-11-29 00:57:46 |
合計ジャッジ時間 | 1,733 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 WA * 17 |
ソースコード
#!/usr/bin/env python3.8 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from functools import lru_cache # %% N, C, V = map(int, read().split()) # %% @lru_cache(None) def f(N): # N倍するためのコスト if N == 1: return 0 sqN = int(N ** .5) ret = 10 ** 9 for i in range(2, N + 1): j = N // i if j <= sqN: break x = C + (i - 1) * V + f(j) if ret > x: ret = x for j in range(1, sqN + 1): i = (N + j - 1) // j x = C + (i - 1) * V + f(j) if ret > x: ret = x return ret # %% print(f(N))