結果

問題 No.1231 Make a Multiple of Ten
ユーザー komkompikomkompi
提出日時 2020-10-21 21:39:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,491 ms / 2,000 ms
コード長 259 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 10,684 KB
実行使用メモリ 30,472 KB
最終ジャッジ日時 2023-09-28 14:25:51
合計ジャッジ時間 10,875 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,996 KB
testcase_01 AC 16 ms
7,820 KB
testcase_02 AC 16 ms
7,828 KB
testcase_03 AC 16 ms
7,880 KB
testcase_04 AC 664 ms
18,096 KB
testcase_05 AC 581 ms
16,656 KB
testcase_06 AC 250 ms
11,372 KB
testcase_07 AC 703 ms
18,512 KB
testcase_08 AC 423 ms
13,972 KB
testcase_09 AC 157 ms
9,980 KB
testcase_10 AC 674 ms
17,256 KB
testcase_11 AC 771 ms
19,328 KB
testcase_12 AC 1,357 ms
29,252 KB
testcase_13 AC 1,403 ms
30,472 KB
testcase_14 AC 16 ms
7,876 KB
testcase_15 AC 1,491 ms
29,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
N=int(input())
A=list(map(int,input().split()))

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

for a in A:
    temp=dp[:]
    for i in range(10):
        if dp[i]!=-1:
            temp[(a+i)%10]=max(dp[i]+1,temp[(a+i)%10])
    dp=temp[:]

print(dp[0])
0