結果

問題 No.1231 Make a Multiple of Ten
ユーザー trineutrontrineutron
提出日時 2020-09-22 16:42:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,336 ms / 2,000 ms
コード長 233 bytes
コンパイル時間 737 ms
コンパイル使用メモリ 10,564 KB
実行使用メモリ 30,456 KB
最終ジャッジ日時 2023-09-08 13:02:26
合計ジャッジ時間 9,677 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,752 KB
testcase_01 AC 15 ms
7,776 KB
testcase_02 AC 16 ms
7,844 KB
testcase_03 AC 16 ms
7,824 KB
testcase_04 AC 630 ms
17,896 KB
testcase_05 AC 536 ms
16,556 KB
testcase_06 AC 219 ms
11,416 KB
testcase_07 AC 642 ms
18,452 KB
testcase_08 AC 366 ms
13,784 KB
testcase_09 AC 142 ms
9,892 KB
testcase_10 AC 568 ms
17,168 KB
testcase_11 AC 682 ms
19,360 KB
testcase_12 AC 1,230 ms
29,572 KB
testcase_13 AC 1,336 ms
30,456 KB
testcase_14 AC 16 ms
7,828 KB
testcase_15 AC 1,305 ms
29,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
dp = [-10**9] * 10
dp[0] = 0
for x in a:
    dp_new = [0] * 10
    for i in range(10):
        dp_new[(i + x) % 10] = max(dp[(i + x) % 10], dp[i] + 1)
    dp = dp_new
print(dp[0])
0