結果

問題 No.1231 Make a Multiple of Ten
ユーザー yakeshibayakeshiba
提出日時 2021-03-08 21:57:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 372 ms / 2,000 ms
コード長 346 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 82,440 KB
実行使用メモリ 101,528 KB
最終ジャッジ日時 2024-04-18 18:15:31
合計ジャッジ時間 4,230 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
54,244 KB
testcase_01 AC 39 ms
54,808 KB
testcase_02 AC 39 ms
54,792 KB
testcase_03 AC 40 ms
55,148 KB
testcase_04 AC 210 ms
89,496 KB
testcase_05 AC 190 ms
87,176 KB
testcase_06 AC 122 ms
79,604 KB
testcase_07 AC 228 ms
90,532 KB
testcase_08 AC 156 ms
83,336 KB
testcase_09 AC 105 ms
78,616 KB
testcase_10 AC 197 ms
89,204 KB
testcase_11 AC 222 ms
90,992 KB
testcase_12 AC 348 ms
101,528 KB
testcase_13 AC 368 ms
100,792 KB
testcase_14 AC 41 ms
55,040 KB
testcase_15 AC 372 ms
100,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import copy

n = int(input())
A = list(map(lambda x:int(x)%10,input().split()))

dp = [0]*10

#print("A =",A)

for j,a in enumerate(A):
    if j == 0:
        dp[a] = 1
        continue
    cp = copy.deepcopy(dp)
    for i in range(10):
        if cp[i] != 0:
            dp[(i+a)%10] = max(cp[(i+a)%10],cp[i]+1)
    #print(dp)
    
print(dp[0])
0