結果

問題 No.1231 Make a Multiple of Ten
ユーザー titiatitia
提出日時 2020-09-18 21:43:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 474 ms / 2,000 ms
コード長 280 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 115,064 KB
最終ジャッジ日時 2023-09-05 18:12:59
合計ジャッジ時間 5,186 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,424 KB
testcase_01 AC 92 ms
71,636 KB
testcase_02 AC 91 ms
71,544 KB
testcase_03 AC 92 ms
71,752 KB
testcase_04 AC 282 ms
90,596 KB
testcase_05 AC 260 ms
88,180 KB
testcase_06 AC 175 ms
81,116 KB
testcase_07 AC 290 ms
91,960 KB
testcase_08 AC 214 ms
83,440 KB
testcase_09 AC 154 ms
79,284 KB
testcase_10 AC 272 ms
89,548 KB
testcase_11 AC 301 ms
92,960 KB
testcase_12 AC 456 ms
114,384 KB
testcase_13 AC 474 ms
114,208 KB
testcase_14 AC 96 ms
71,296 KB
testcase_15 AC 473 ms
115,064 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