結果

問題 No.1231 Make a Multiple of Ten
ユーザー tobusakanatobusakana
提出日時 2022-11-26 13:17:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 277 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 82,396 KB
実行使用メモリ 107,492 KB
最終ジャッジ日時 2024-04-10 14:34:41
合計ジャッジ時間 2,693 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,524 KB
testcase_01 AC 32 ms
52,216 KB
testcase_02 AC 32 ms
51,888 KB
testcase_03 AC 33 ms
52,316 KB
testcase_04 AC 79 ms
89,220 KB
testcase_05 AC 74 ms
87,268 KB
testcase_06 AC 55 ms
76,404 KB
testcase_07 AC 77 ms
90,564 KB
testcase_08 AC 61 ms
81,952 KB
testcase_09 AC 47 ms
69,708 KB
testcase_10 AC 76 ms
89,048 KB
testcase_11 AC 82 ms
90,864 KB
testcase_12 AC 117 ms
107,492 KB
testcase_13 AC 122 ms
102,304 KB
testcase_14 AC 33 ms
52,412 KB
testcase_15 AC 119 ms
102,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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])
0