結果
| 問題 |
No.8046 yukicoderの過去問
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-04-01 21:39:19 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 677 bytes |
| コンパイル時間 | 1,583 ms |
| コンパイル使用メモリ | 170,748 KB |
| 実行使用メモリ | 13,640 KB |
| 最終ジャッジ日時 | 2024-11-26 21:50:32 |
| 合計ジャッジ時間 | 11,095 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 TLE * 3 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
ll modpow(ll x, ll n, ll mod = MOD) {
ll res = 1;
while (n > 0) {
if (n & 1) res = res * x % mod;
x = x * x % mod;
n >>= 1;
}
return res;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int K, n;
cin >> K >> n;
vector<int> x(n);
for (int i = 0; i < n; i++) cin >> x[i];
vector<ll> dp(K + 1, 0);
dp[0] = 1;
for (int i = 1; i <= K; i++) {
for (int y : x) {
if (i < y) break;
(dp[i] += dp[i - y]) %= MOD;
}
}
cout << dp[K] << endl;
return 0;
}