結果

問題 No.1231 Make a Multiple of Ten
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2020-09-18 21:32:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 218 ms / 2,000 ms
コード長 308 bytes
コンパイル時間 1,048 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 100,624 KB
最終ジャッジ日時 2023-09-05 18:09:53
合計ジャッジ時間 3,298 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,276 KB
testcase_01 AC 74 ms
71,116 KB
testcase_02 AC 75 ms
71,256 KB
testcase_03 AC 74 ms
70,924 KB
testcase_04 AC 143 ms
90,272 KB
testcase_05 AC 136 ms
88,572 KB
testcase_06 AC 109 ms
80,364 KB
testcase_07 AC 150 ms
91,876 KB
testcase_08 AC 121 ms
83,080 KB
testcase_09 AC 101 ms
78,428 KB
testcase_10 AC 141 ms
89,736 KB
testcase_11 AC 151 ms
92,204 KB
testcase_12 AC 212 ms
100,488 KB
testcase_13 AC 218 ms
100,624 KB
testcase_14 AC 72 ms
71,160 KB
testcase_15 AC 213 ms
100,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dp = [float("-inf")] * 10
dp[0] = 0

for i in range(N):

    ndp = [float("-inf")] * 10

    for j in range(10):

        ndp[j] = max(ndp[j] , dp[j])
        ndp[(A[i] + j) % 10] = max( ndp[(A[i] + j) % 10] , dp[j] + 1)

    dp = ndp
    
print (dp[0])
0