結果

問題 No.3046 yukicoderの過去問
ユーザー cielciel
提出日時 2019-04-07 20:51:36
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 398 bytes
コンパイル時間 506 ms
コンパイル使用メモリ 108,928 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-05-07 19:00:47
合計ジャッジ時間 3,883 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,752 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 4 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include <vector>
#include <cstdio>
using namespace std;

const int M=1000000007;
int main(){
	int K,N;
	scanf("%d%d",&K,&N);
	vector<int> k(K+1);k[0]=1;
	vector<int> x(N);
	for(int i=0;i<N;i++)scanf("%d",&x[i]);
	for(int i=1;i<=K;i++)for(int j=0;j<N;j++){
		if(i>=x[j]){
			k[i]+=k[i-x[j]];
			if(k[i]>=M)k[i]-=M;
		}
	}
	printf("%d\n",k[K]);
}
0