結果

問題 No.1231 Make a Multiple of Ten
ユーザー prd_xxxprd_xxx
提出日時 2020-09-18 21:42:53
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 291 ms / 2,000 ms
コード長 361 bytes
コンパイル時間 882 ms
コンパイル使用メモリ 87,372 KB
実行使用メモリ 148,800 KB
最終ジャッジ日時 2023-09-05 18:12:51
合計ジャッジ時間 3,636 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,340 KB
testcase_01 AC 69 ms
71,260 KB
testcase_02 AC 69 ms
71,272 KB
testcase_03 AC 70 ms
71,360 KB
testcase_04 AC 160 ms
96,412 KB
testcase_05 AC 154 ms
96,472 KB
testcase_06 AC 110 ms
85,324 KB
testcase_07 AC 162 ms
96,612 KB
testcase_08 AC 129 ms
90,864 KB
testcase_09 AC 104 ms
82,128 KB
testcase_10 AC 160 ms
96,536 KB
testcase_11 AC 174 ms
96,492 KB
testcase_12 AC 265 ms
134,272 KB
testcase_13 AC 291 ms
148,800 KB
testcase_14 AC 84 ms
71,244 KB
testcase_15 AC 291 ms
148,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))

dp = [[None]*10 for _ in range(N+1)]
dp[0][0] = 0
for i,a in enumerate(A):
    for d in range(10):
        dp[i+1][d] = dp[i][d]
    for d in range(10):
        if dp[i][d] is None: continue
        n = (d+a)%10
        dp[i+1][n] = max(0 if dp[i+1][n] is None else dp[i+1][n], dp[i][d] + 1)
print(dp[-1][0])
0