結果

問題 No.1231 Make a Multiple of Ten
ユーザー zer0zer0
提出日時 2020-09-21 17:49:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 282 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 10,612 KB
実行使用メモリ 30,408 KB
最終ジャッジ日時 2023-09-06 17:22:18
合計ジャッジ時間 14,753 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,920 KB
testcase_01 AC 15 ms
7,772 KB
testcase_02 AC 16 ms
7,836 KB
testcase_03 AC 15 ms
7,852 KB
testcase_04 AC 1,108 ms
17,968 KB
testcase_05 AC 951 ms
16,736 KB
testcase_06 AC 371 ms
11,332 KB
testcase_07 AC 1,120 ms
18,500 KB
testcase_08 AC 659 ms
13,872 KB
testcase_09 AC 233 ms
10,064 KB
testcase_10 AC 1,001 ms
17,204 KB
testcase_11 AC 1,162 ms
19,204 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 AC 15 ms
7,812 KB
testcase_15 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
a = list(map(int, input().split()))

dp = [-1] * 10
dp[0] = 0
for i in range(N):
    cdp = dp[:]
    for j in range(10):
        if cdp[j] != -1:
            dp[(j + a[i]) % 10] = max(dp[(j + a[i]) % 10], cdp[j] + 1)
        dp[j] = max(dp[j], cdp[j])

print(dp[0])
0