結果

問題 No.1231 Make a Multiple of Ten
ユーザー ntudantuda
提出日時 2024-01-07 21:44:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 271 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 106,848 KB
最終ジャッジ日時 2024-01-07 21:44:54
合計ジャッジ時間 3,612 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,332 KB
testcase_01 AC 59 ms
53,332 KB
testcase_02 AC 38 ms
53,332 KB
testcase_03 AC 39 ms
53,332 KB
testcase_04 AC 92 ms
88,544 KB
testcase_05 AC 87 ms
86,772 KB
testcase_06 AC 66 ms
78,508 KB
testcase_07 AC 93 ms
90,212 KB
testcase_08 AC 72 ms
81,704 KB
testcase_09 AC 57 ms
73,580 KB
testcase_10 AC 85 ms
88,300 KB
testcase_11 AC 89 ms
90,460 KB
testcase_12 AC 124 ms
106,848 KB
testcase_13 AC 135 ms
101,588 KB
testcase_14 AC 39 ms
53,332 KB
testcase_15 AC 130 ms
101,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
dp = [-1] * 10
dp[0] = 0
for a in A:
    dp2 = [-1] * 10
    for i in range(10):
        if dp[i] > -1:
            dp2[(i + a) % 10] = dp[i] + 1
    for i in range(10):
        dp[i] = max(dp[i], dp2[i])
print(dp[0])
0