結果

問題 No.1231 Make a Multiple of Ten
ユーザー tktk_snsntktk_snsn
提出日時 2020-12-13 00:37:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,316 ms / 2,000 ms
コード長 263 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 11,848 KB
実行使用メモリ 32,344 KB
最終ジャッジ日時 2023-10-20 02:50:05
合計ジャッジ時間 9,023 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,096 KB
testcase_01 AC 30 ms
10,096 KB
testcase_02 AC 31 ms
10,096 KB
testcase_03 AC 30 ms
10,096 KB
testcase_04 AC 658 ms
19,952 KB
testcase_05 AC 559 ms
18,616 KB
testcase_06 AC 235 ms
13,348 KB
testcase_07 AC 670 ms
20,508 KB
testcase_08 AC 393 ms
15,824 KB
testcase_09 AC 151 ms
11,944 KB
testcase_10 AC 585 ms
19,212 KB
testcase_11 AC 705 ms
21,240 KB
testcase_12 AC 1,253 ms
31,192 KB
testcase_13 AC 1,316 ms
32,344 KB
testcase_14 AC 29 ms
10,096 KB
testcase_15 AC 1,309 ms
31,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
inf = 10**9

dp = [-inf] * 10
dp[0] = 0

for a in A:
    nxt = [-inf] * 10
    for i in range(10):
        x = (i + a) % 10
        nxt[x] = dp[i] + 1
    dp = [max(x, y) for x, y in zip(dp, nxt)]

print(dp[0])
0