結果

問題 No.1457 ツブ消ししとるなHard
ユーザー pengin_2000pengin_2000
提出日時 2022-10-13 23:15:06
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 766 bytes
コンパイル時間 504 ms
コンパイル使用メモリ 29,528 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-08 19:17:33
合計ジャッジ時間 2,271 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 0 ms
4,384 KB
testcase_02 AC 0 ms
4,384 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 6 ms
4,384 KB
testcase_05 AC 6 ms
4,384 KB
testcase_06 AC 6 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 4 ms
4,384 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,384 KB
testcase_15 AC 2 ms
4,384 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,384 KB
testcase_18 AC 0 ms
4,380 KB
testcase_19 AC 6 ms
4,380 KB
testcase_20 AC 1 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
long long int a[55];
long long int dp[55][3003];
int main()
{
	long long int n, m, x, y, z;
	scanf("%lld %lld %lld %lld %lld", &n, &m, &x, &y, &z);
	long long int i, j, k;
	for (i = 0; i < n; i++)
		scanf("%lld", &a[i]);
	for (i = 0; i < n; i++)
		for (j = 0; j < 3003; j++)
			dp[i][j] = 0;
	for (i = j = k = 0; i < n; i++)
	{
		if (a[i] >= x)
		{
			j++;
			k += a[i];
		}
	}
	if (j > m)
	{
		printf("Handicapped\n");
		return 0;
	}
	dp[j][k] = 1;
	for (i = 0; i < n; i++)
	{
		if (a[i] <= y)
			continue;
		if (a[i] >= x)
			continue;
		for (j = m - 1; j >= 0; j--)
			for (k = 0; k < 3003; k++)
				dp[j + 1][k + a[i]] += dp[j][k];
	}
	long long int ans = 0;
	for (i = 1; i <= m; i++)
		ans += dp[i][i * z];
	printf("%lld\n", ans);
	return 0;
}
0