結果

問題 No.1231 Make a Multiple of Ten
ユーザー yvay5cqeyvay5cqe
提出日時 2020-09-28 02:53:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 181 ms / 2,000 ms
コード長 325 bytes
コンパイル時間 1,387 ms
コンパイル使用メモリ 86,648 KB
実行使用メモリ 100,012 KB
最終ジャッジ日時 2023-09-13 13:58:51
合計ジャッジ時間 4,237 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,168 KB
testcase_01 AC 76 ms
71,224 KB
testcase_02 AC 76 ms
71,220 KB
testcase_03 AC 74 ms
71,340 KB
testcase_04 AC 139 ms
88,228 KB
testcase_05 AC 132 ms
86,868 KB
testcase_06 AC 106 ms
80,100 KB
testcase_07 AC 134 ms
89,320 KB
testcase_08 AC 111 ms
82,104 KB
testcase_09 AC 100 ms
78,636 KB
testcase_10 AC 129 ms
87,632 KB
testcase_11 AC 139 ms
89,796 KB
testcase_12 AC 178 ms
99,516 KB
testcase_13 AC 181 ms
100,012 KB
testcase_14 AC 76 ms
71,232 KB
testcase_15 AC 179 ms
99,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = map(int, input().split())
dp = [-1 for _ in range(10)]
dp[0] = 0
for a in A:
    tmp = [-1 for _ in range(10)]
    for i in range(10):
        if dp[i] == -1:
            continue
        tmp[i] = max(tmp[i], dp[i])
        tmp[(i + a) % 10] = max(tmp[(i + a) % 10], dp[i] + 1)
    dp = tmp
print(dp[0])
0