結果
| 問題 |
No.8046 yukicoderの過去問
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-09 23:37:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 720 bytes |
| コンパイル時間 | 1,487 ms |
| コンパイル使用メモリ | 170,460 KB |
| 実行使用メモリ | 13,752 KB |
| 最終ジャッジ日時 | 2024-07-07 05:07:33 |
| 合計ジャッジ時間 | 5,206 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 TLE * 1 -- * 2 |
ソースコード
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main()
{
int K, N;
cin >> K >> N;
vector<int>steps(N);
for (int i=0; i<N; i++) {
cin >> steps.at(i);
}
vector<int64_t>dp(K+1);
dp[0] = 1;
for (int i=0; i<=K; i++) {
for (int j=0; j<N; j++) {
if (i+steps[j]<=K) {
dp[i+steps[j]] += dp[i];
dp[i+steps[j]] %= 1000000007;
}
}
}
cout << dp[K] << endl;
return 0;
}