結果

問題 No.1231 Make a Multiple of Ten
ユーザー 👑 KazunKazun
提出日時 2020-09-19 01:28:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 255 ms / 2,000 ms
コード長 248 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 86,968 KB
実行使用メモリ 141,868 KB
最終ジャッジ日時 2023-09-05 18:24:55
合計ジャッジ時間 3,585 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,144 KB
testcase_01 AC 72 ms
71,200 KB
testcase_02 AC 71 ms
71,088 KB
testcase_03 AC 72 ms
71,280 KB
testcase_04 AC 153 ms
96,584 KB
testcase_05 AC 144 ms
95,464 KB
testcase_06 AC 108 ms
85,952 KB
testcase_07 AC 153 ms
97,440 KB
testcase_08 AC 121 ms
91,296 KB
testcase_09 AC 98 ms
81,536 KB
testcase_10 AC 151 ms
96,044 KB
testcase_11 AC 162 ms
97,932 KB
testcase_12 AC 249 ms
141,280 KB
testcase_13 AC 255 ms
141,868 KB
testcase_14 AC 73 ms
71,160 KB
testcase_15 AC 253 ms
141,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=["*"]+list(map(int,input().split()))

inf=float("inf")
DP=[[-inf]*10 for _ in range(N+1)]
DP[0][0]=0

for i in range(1,N+1):
    a=A[i]%10
    for m in range(10):
        DP[i][m]=max(DP[i-1][m],DP[i-1][(m-a)%10]+1)
print(DP[N][0])
0