結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,856 KB
testcase_01 AC 15 ms
7,840 KB
testcase_02 AC 15 ms
7,928 KB
testcase_03 AC 14 ms
7,852 KB
testcase_04 AC 1,058 ms
17,912 KB
testcase_05 AC 931 ms
16,716 KB
testcase_06 AC 389 ms
11,600 KB
testcase_07 AC 1,057 ms
18,600 KB
testcase_08 AC 655 ms
13,804 KB
testcase_09 AC 229 ms
10,036 KB
testcase_10 AC 1,025 ms
17,352 KB
testcase_11 AC 1,188 ms
19,212 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 AC 15 ms
7,860 KB
testcase_15 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
a = list(map(int, input().split()))
for i in range(N):
    a[i] = a[i] % 10
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