結果
問題 |
No.8046 yukicoderの過去問
|
ユーザー |
![]() |
提出日時 | 2019-04-01 21:50:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 988 bytes |
コンパイル時間 | 890 ms |
コンパイル使用メモリ | 91,424 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-11-26 22:27:24 |
合計ジャッジ時間 | 10,208 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 TLE * 3 |
ソースコード
#include <cstdio> #include <iostream> #include <string> #include <sstream> #include <stack> #include <algorithm> #include <cmath> #include <queue> #include <map> #include <set> #include <cstdlib> #include <bitset> template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } char ToUpper(char cX) { return toupper(cX); } char Tolower(char cX) { return tolower(cX); } const long long INF = 1LL << 60; const long long MOD = 1000000007; using namespace std; typedef unsigned long long ull; typedef long long ll; vector<ll> dp; int main() { ll k, n; cin >> k >> n; vector<ll>a(n); for (ll i = 0; i < n; i++) { cin >> a[i]; } dp = vector<ll>(k + 1, 0); dp[0] = 1; for (ll i = 0; i <= k; i++) { for (ll j = 0; j < a.size(); j++) { if (i - a[j] >= 0) { dp[i] += dp[i - a[j]]; dp[i] %= MOD; } } } cout << dp[k] << endl; return 0; }