結果

問題 No.1231 Make a Multiple of Ten
ユーザー 👑 deuteridayodeuteridayo
提出日時 2020-09-18 21:41:09
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 384 bytes
コンパイル時間 1,451 ms
コンパイル使用メモリ 168,564 KB
実行使用メモリ 28,124 KB
最終ジャッジ日時 2023-09-05 18:11:56
合計ジャッジ時間 2,951 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 49 ms
14,372 KB
testcase_05 AC 43 ms
13,112 KB
testcase_06 AC 18 ms
7,040 KB
testcase_07 AC 51 ms
15,032 KB
testcase_08 AC 21 ms
9,916 KB
testcase_09 AC 11 ms
5,520 KB
testcase_10 AC 45 ms
13,616 KB
testcase_11 AC 54 ms
15,996 KB
testcase_12 AC 98 ms
26,744 KB
testcase_13 AC 104 ms
28,124 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 104 ms
28,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main(){
    long n;
    cin >> n;
    long a[n];
    for(int i=0;i<n;i++)cin >> a[i];
    vector<vector<long> >dp(n+1,vector<long>(10,-1<<30));
    dp[0][0] = 0;
    for(int i=0;i<n;i++){
        for(int j=0;j<10;j++){
            dp[i+1][(j+a[i])%10] = max(dp[i][j]+1,dp[i][(j+a[i])%10]);
        }
    }
    cout << dp[n][0]<<endl;
}
0