結果
問題 | No.1231 Make a Multiple of Ten |
ユーザー |
|
提出日時 | 2020-09-18 21:36:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 34 ms / 2,000 ms |
コード長 | 544 bytes |
コンパイル時間 | 1,661 ms |
コンパイル使用メモリ | 168,960 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 13:39:44 |
合計ジャッジ時間 | 2,635 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;constexpr char newl = '\n';int main() {cin.tie(nullptr);ios::sync_with_stdio(false);int n;cin >> n;vector<int> dp(10, -1e9);dp[0] = 0;for (int i = 0; i < n; i++) {int a;cin >> a;a %= 10;vector<int> ndp(10, 0);for (int j = 0; j < 10; j++) {ndp[(j + a) % 10] = max(dp[(j + a) % 10], dp[j] + 1);}dp = move(ndp);}cout << dp[0] << newl;return 0;}