結果

問題 No.1231 Make a Multiple of Ten
ユーザー brthyyjpbrthyyjp
提出日時 2020-09-18 23:20:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 228 ms / 2,000 ms
コード長 313 bytes
コンパイル時間 928 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 119,956 KB
最終ジャッジ日時 2023-09-05 18:23:58
合計ジャッジ時間 3,485 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,128 KB
testcase_01 AC 76 ms
71,180 KB
testcase_02 AC 76 ms
70,876 KB
testcase_03 AC 76 ms
71,424 KB
testcase_04 AC 147 ms
94,240 KB
testcase_05 AC 132 ms
92,760 KB
testcase_06 AC 113 ms
84,836 KB
testcase_07 AC 153 ms
95,704 KB
testcase_08 AC 125 ms
90,440 KB
testcase_09 AC 99 ms
77,836 KB
testcase_10 AC 148 ms
94,012 KB
testcase_11 AC 160 ms
95,460 KB
testcase_12 AC 220 ms
118,188 KB
testcase_13 AC 228 ms
119,824 KB
testcase_14 AC 77 ms
71,076 KB
testcase_15 AC 226 ms
119,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
INF = 10**18
dp = [[-INF]*10 for _ in range(n+1)]
dp[0][0] = 0
for i in range(n):
    a = A[i]
    for j in range(10):
        dp[i+1][j] = dp[i][j]
    for j in range(10):
        k = (j+a)%10
        dp[i+1][k] = max(dp[i+1][k], dp[i][j]+1)
print(dp[-1][0])
0