結果

問題 No.1231 Make a Multiple of Ten
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-03-15 16:42:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 231 bytes
コンパイル時間 379 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 107,300 KB
最終ジャッジ日時 2024-04-24 19:15:02
合計ジャッジ時間 3,413 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,864 KB
testcase_01 AC 39 ms
52,224 KB
testcase_02 AC 37 ms
52,128 KB
testcase_03 AC 38 ms
52,608 KB
testcase_04 AC 87 ms
89,072 KB
testcase_05 AC 91 ms
87,424 KB
testcase_06 AC 65 ms
79,128 KB
testcase_07 AC 95 ms
90,800 KB
testcase_08 AC 72 ms
82,304 KB
testcase_09 AC 59 ms
72,192 KB
testcase_10 AC 87 ms
88,832 KB
testcase_11 AC 91 ms
90,960 KB
testcase_12 AC 126 ms
107,300 KB
testcase_13 AC 135 ms
101,896 KB
testcase_14 AC 38 ms
52,480 KB
testcase_15 AC 135 ms
102,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
dp=[-1]*10
dp[0]=0
for x in a:
  x%=10
  ndp=[-1]*10
  for d in range(10):
    if dp[d]>=0:
      ndp[(d+x)%10]=dp[d]+1
  for d in range(10):
    dp[d]=max(dp[d],ndp[d])
print(dp[0])
0