結果

問題 No.1231 Make a Multiple of Ten
ユーザー titiatitia
提出日時 2020-09-18 21:43:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 428 ms / 2,000 ms
コード長 280 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 82,300 KB
実行使用メモリ 100,904 KB
最終ジャッジ日時 2024-06-23 13:41:58
合計ジャッジ時間 4,006 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
54,596 KB
testcase_01 AC 41 ms
54,336 KB
testcase_02 AC 41 ms
53,748 KB
testcase_03 AC 40 ms
53,556 KB
testcase_04 AC 227 ms
88,620 KB
testcase_05 AC 218 ms
87,168 KB
testcase_06 AC 128 ms
80,180 KB
testcase_07 AC 239 ms
90,180 KB
testcase_08 AC 165 ms
82,904 KB
testcase_09 AC 102 ms
78,796 KB
testcase_10 AC 221 ms
88,480 KB
testcase_11 AC 250 ms
90,108 KB
testcase_12 AC 408 ms
100,840 KB
testcase_13 AC 424 ms
100,904 KB
testcase_14 AC 39 ms
53,352 KB
testcase_15 AC 428 ms
100,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
import copy

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

DP=[-1]*10
DP[0]=0

for a in A:
    NDP=copy.deepcopy(DP)
    for i in range(10):
        if DP[i]!=-1:
            NDP[(i+a)%10]=max(DP[(i+a)%10],DP[i]+1)
    DP=NDP

print(DP[0])
0