結果
| 問題 |
No.8046 yukicoderの過去問
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-23 22:09:48 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 751 bytes |
| コンパイル時間 | 1,567 ms |
| コンパイル使用メモリ | 168,720 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2024-10-15 19:22:55 |
| 合計ジャッジ時間 | 5,311 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 TLE * 1 -- * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ld long double
#define INF 1000000000000000000
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll K, N;
cin >> K >> N;
vector<ll> x(N);
ll MOD = pow(10, 9) + 7;
rep(i, N) { cin >> x[i]; }
vector<ll> dp(K + 5, 0);
dp[0] = 1;
for (int i = 0; i < K + 5; i++) {
for (int j = 0; j < N; j++) {
if (i + x[j] < K + 5) {
dp[i + x[j]] += dp[i];
dp[i + x[j]] %= MOD;
}
}
}
cout << dp[K] << endl;
return 0;
}