結果

問題 No.1231 Make a Multiple of Ten
ユーザー zer0zer0
提出日時 2020-09-21 15:40:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 371 bytes
コンパイル時間 505 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 98,804 KB
最終ジャッジ日時 2023-09-06 17:10:22
合計ジャッジ時間 17,086 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,176 KB
testcase_01 AC 15 ms
7,860 KB
testcase_02 AC 14 ms
7,756 KB
testcase_03 AC 15 ms
7,788 KB
testcase_04 AC 1,452 ms
48,212 KB
testcase_05 AC 1,279 ms
43,140 KB
testcase_06 AC 500 ms
22,012 KB
testcase_07 AC 1,485 ms
50,104 KB
testcase_08 AC 849 ms
32,520 KB
testcase_09 AC 297 ms
16,020 KB
testcase_10 AC 1,348 ms
45,412 KB
testcase_11 AC 1,591 ms
53,180 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
a = list(map(int, input().split()))
for i in range(N):
    a[i] = a[i] % 10
dp = [[0] * 10 for _ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
    for j in range(10):
        if dp[i][j] != 0:
            dp[i + 1][(j + a[i]) % 10] = max(dp[i + 1][(j + a[i]) % 10], dp[i][j] + 1)
        dp[i + 1][j] = max(dp[i][j], dp[i + 1][j])

print(dp[N][0] - 1)
0