結果

問題 No.1231 Make a Multiple of Ten
ユーザー aqua_tenhouaqua_tenhou
提出日時 2020-09-18 21:45:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 217 ms / 2,000 ms
コード長 280 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 86,872 KB
実行使用メモリ 100,732 KB
最終ジャッジ日時 2023-09-05 18:13:25
合計ジャッジ時間 3,485 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,440 KB
testcase_01 AC 80 ms
71,284 KB
testcase_02 AC 76 ms
71,292 KB
testcase_03 AC 75 ms
71,148 KB
testcase_04 AC 143 ms
90,060 KB
testcase_05 AC 138 ms
88,188 KB
testcase_06 AC 115 ms
80,392 KB
testcase_07 AC 147 ms
92,008 KB
testcase_08 AC 120 ms
83,312 KB
testcase_09 AC 102 ms
78,284 KB
testcase_10 AC 137 ms
89,744 KB
testcase_11 AC 149 ms
91,948 KB
testcase_12 AC 217 ms
100,732 KB
testcase_13 AC 215 ms
100,676 KB
testcase_14 AC 72 ms
71,340 KB
testcase_15 AC 203 ms
100,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int,input().split()))

d = [-float("Inf")]*10
d[0] = 0
for x in a:
    dnext = [-float("Inf")]*10
    for j in range(10):
        dnext[j] = max(dnext[j],d[j])
        dnext[(x+j)%10] = max(dnext[(x+j)%10],d[j] + 1)
        
    d = dnext
print(d[0])
0