結果

問題 No.664 超能力者Aと株価予測
ユーザー vwxyzvwxyz
提出日時 2022-04-08 01:56:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,397 ms / 4,000 ms
コード長 406 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 10,860 KB
実行使用メモリ 8,388 KB
最終ジャッジ日時 2023-08-18 19:18:58
合計ジャッジ時間 5,583 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,832 KB
testcase_01 AC 17 ms
7,952 KB
testcase_02 AC 18 ms
7,868 KB
testcase_03 AC 17 ms
7,816 KB
testcase_04 AC 15 ms
7,800 KB
testcase_05 AC 16 ms
7,736 KB
testcase_06 AC 34 ms
7,956 KB
testcase_07 AC 34 ms
7,820 KB
testcase_08 AC 341 ms
7,792 KB
testcase_09 AC 30 ms
7,760 KB
testcase_10 AC 693 ms
7,800 KB
testcase_11 AC 1,045 ms
8,180 KB
testcase_12 AC 1,397 ms
8,388 KB
testcase_13 AC 825 ms
7,912 KB
testcase_14 AC 16 ms
7,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline

N,M,K=map(int,readline().split())
A=[int(readline()) for i in range(N+1)]
dp=[[0]*(M+1) for n in range(N+2)]
dp[0][0]=K
for n in range(1,N+2):
    for m in range(M+1):
        dp[n][m]=dp[n-1][m]
    for m in range(1,M+1):
        for nn in range(n):
            x,y=divmod(dp[nn][m-1],A[nn])
            dp[n][m]=max(dp[n][m],x*A[n-1]+y)
ans=max(dp[N+1])
print(ans)
0