結果

問題 No.3046 yukicoderの過去問
ユーザー kotatsugamekotatsugame
提出日時 2020-03-09 03:32:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 334 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 32,640 KB
実行使用メモリ 9,344 KB
最終ジャッジ日時 2024-04-25 09:55:57
合計ジャッジ時間 4,233 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
9,344 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#include<cstdio>
using namespace std;
const int mod=1e9+7;
int K,N;
int dp[2<<17];
int x[1<<17];
main()
{
	scanf("%d%d",&K,&N);
	for(int i=0;i<N;i++)scanf("%d",&x[i]);
	dp[0]=1;
	for(int i=1;i<=K;i++)
	{
		long now=0;
		for(int j=0;j<N;j++)
		{
			if(i<x[j])break;
			now+=dp[i-x[j]];
		}
		dp[i]=now%mod;
	}
	printf("%d\n",dp[K]);
}
0