結果

問題 No.1231 Make a Multiple of Ten
ユーザー googol_S0googol_S0
提出日時 2020-09-18 21:26:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 253 ms / 2,000 ms
コード長 261 bytes
コンパイル時間 1,823 ms
コンパイル使用メモリ 86,536 KB
実行使用メモリ 140,244 KB
最終ジャッジ日時 2023-09-05 18:08:17
合計ジャッジ時間 3,581 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,068 KB
testcase_01 AC 74 ms
71,060 KB
testcase_02 AC 74 ms
71,288 KB
testcase_03 AC 74 ms
71,124 KB
testcase_04 AC 160 ms
102,604 KB
testcase_05 AC 153 ms
100,880 KB
testcase_06 AC 117 ms
85,172 KB
testcase_07 AC 164 ms
104,288 KB
testcase_08 AC 133 ms
91,584 KB
testcase_09 AC 99 ms
77,656 KB
testcase_10 AC 157 ms
102,180 KB
testcase_11 AC 170 ms
107,696 KB
testcase_12 AC 244 ms
138,716 KB
testcase_13 AC 253 ms
140,236 KB
testcase_14 AC 77 ms
71,056 KB
testcase_15 AC 252 ms
140,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
DP=[[-N]*10 for i in range(N+1)]
DP[0][0]=0
A=list(map(int,input().split()))
for i in range(N):
  A[i]%=10
  for j in range(10):
    DP[i+1][j]=max(DP[i+1][j],DP[i][j])
    DP[i+1][(j+A[i])%10]=max(DP[i+1][(j+A[i])%10],DP[i][j]+1)
print(DP[N][0])
0