結果
| 問題 |
No.1231 Make a Multiple of Ten
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-26 13:17:50 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 150 ms / 2,000 ms |
| コード長 | 277 bytes |
| コンパイル時間 | 288 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 107,136 KB |
| 最終ジャッジ日時 | 2024-10-02 16:23:12 |
| 合計ジャッジ時間 | 3,142 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
N = int(input())
A = list(map(int,input().split()))
dp = [-1] * 10
dp[0] = 0
for a in A:
new_dp = dp.copy()
for i in range(10):
if dp[i] == -1:
continue
new_val = (i + a) % 10
new_dp[new_val] = max(new_dp[new_val], dp[i] + 1)
dp = new_dp
print(dp[0])