結果
問題 | No.1231 Make a Multiple of Ten |
ユーザー | GetDigit() |
提出日時 | 2022-11-03 08:45:59 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 497 bytes |
コンパイル時間 | 1,526 ms |
コンパイル使用メモリ | 164,908 KB |
実行使用メモリ | 12,212 KB |
最終ジャッジ日時 | 2023-09-24 18:34:56 |
合計ジャッジ時間 | 2,707 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 18 ms
7,456 KB |
testcase_05 | AC | 17 ms
6,956 KB |
testcase_06 | AC | 8 ms
4,844 KB |
testcase_07 | AC | 19 ms
7,604 KB |
testcase_08 | AC | 10 ms
5,868 KB |
testcase_09 | AC | 5 ms
4,380 KB |
testcase_10 | AC | 16 ms
7,096 KB |
testcase_11 | AC | 21 ms
7,828 KB |
testcase_12 | AC | 35 ms
11,632 KB |
testcase_13 | AC | 36 ms
12,212 KB |
testcase_14 | WA | - |
testcase_15 | AC | 36 ms
12,164 KB |
ソースコード
#include <bits/stdc++.h> #include <vector> using namespace std; int max(int a,int b){ if(a>b){ return a; } return b; } int main(){ int N; scanf("%d",&N); int a[N]; for(int i=0;i<N;i++){ scanf("%d",&a[i]); a[i] = a[i] % 10; } int dp[N][10] = {}; dp[0][a[0]] = 1; for(int i=1;i<N;i++){ for(int j=0;j<10;j++){ dp[i][j] = max(dp[i-1][j],dp[i-1][(10+j-a[i])%10]+1); } } printf("%d",dp[N-1][0]); }