結果

問題 No.1231 Make a Multiple of Ten
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2020-09-19 13:27:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,281 ms / 2,000 ms
コード長 251 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 10,628 KB
実行使用メモリ 31,800 KB
最終ジャッジ日時 2023-09-05 18:28:16
合計ジャッジ時間 8,994 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,836 KB
testcase_01 AC 16 ms
7,868 KB
testcase_02 AC 16 ms
7,968 KB
testcase_03 AC 15 ms
7,824 KB
testcase_04 AC 596 ms
17,976 KB
testcase_05 AC 554 ms
16,740 KB
testcase_06 AC 218 ms
11,368 KB
testcase_07 AC 662 ms
18,636 KB
testcase_08 AC 379 ms
13,900 KB
testcase_09 AC 136 ms
10,128 KB
testcase_10 AC 565 ms
17,260 KB
testcase_11 AC 692 ms
19,244 KB
testcase_12 AC 1,253 ms
30,644 KB
testcase_13 AC 1,281 ms
31,800 KB
testcase_14 AC 16 ms
7,812 KB
testcase_15 AC 1,260 ms
29,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dp = [-float("INF")]*10
dp[0] = 0
for i in range(n):
    x = a[i]%10
    ndp = [-float("INF")]*10
    for j in range(10):
       ndp[(j+x)%10] = max(dp[j]+1,dp[(j+x)%10])
    dp = ndp
print(dp[0]) 
0