結果

問題 No.1231 Make a Multiple of Ten
ユーザー prd_xxxprd_xxx
提出日時 2020-09-18 21:42:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 361 bytes
コンパイル時間 387 ms
コンパイル使用メモリ 10,924 KB
実行使用メモリ 103,908 KB
最終ジャッジ日時 2023-09-04 10:13:53
合計ジャッジ時間 15,975 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,816 KB
testcase_01 AC 17 ms
7,828 KB
testcase_02 AC 16 ms
7,816 KB
testcase_03 AC 17 ms
7,828 KB
testcase_04 AC 1,157 ms
51,260 KB
testcase_05 AC 998 ms
45,832 KB
testcase_06 AC 404 ms
22,768 KB
testcase_07 AC 1,201 ms
53,124 KB
testcase_08 AC 700 ms
33,796 KB
testcase_09 AC 248 ms
16,972 KB
testcase_10 AC 1,055 ms
47,928 KB
testcase_11 AC 1,275 ms
56,276 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 AC 15 ms
7,776 KB
testcase_15 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dp = [[None]*10 for _ in range(N+1)]
dp[0][0] = 0
for i,a in enumerate(A):
    for d in range(10):
        dp[i+1][d] = dp[i][d]
    for d in range(10):
        if dp[i][d] is None: continue
        n = (d+a)%10
        dp[i+1][n] = max(0 if dp[i+1][n] is None else dp[i+1][n], dp[i][d] + 1)
print(dp[-1][0])
0