记录详情

Wrong Answer


  
# 状态 耗时 内存占用
#1 Wrong Answer 2ms 220.0 KiB
#2 Wrong Answer 1ms 244.0 KiB
#3 Wrong Answer 2ms 216.0 KiB
#4 Wrong Answer 2ms 232.0 KiB
#5 Wrong Answer 1ms 220.0 KiB
#6 Wrong Answer 2ms 224.0 KiB
#7 Wrong Answer 2ms 224.0 KiB
#8 Wrong Answer 2ms 232.0 KiB
#9 Wrong Answer 2ms 220.0 KiB
#10 Wrong Answer 1ms 228.0 KiB
#11 Wrong Answer 1ms 220.0 KiB
#12 Wrong Answer 0ms 128.0 KiB
#13 Wrong Answer 0ms 220.0 KiB

代码

#include<stdio.h>
#include<stdlib.h>
#define maxn 10005
int m = 0, k = 0;
int dp[maxn];
int f(int i)
{
	if (i > m)
	{
		for (int j = 1; j <= m; j++)
		{
			int flag = 1;
			for (int l = k; l >= 1; l--)
				if (i - j - l < 0 || dp[i - j - l] == 0)
				{
					flag = 0;
					break;
				}
			if (flag)
				return 1;
		}
		return 0;
	}
	else
		return 1;
}

int main()
{
	int n;
	int ai[maxn];
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 0; i < n; i++)
		scanf("%d", &ai[i]);
	int max = ai[0];
	for (int i = 1; i < n; i++)
		if (ai[i] > max) max = ai[i];
	dp[0] = 0;
	for (int i = 1; i <= max; i++)
	{
		dp[i] = f(i);
		printf(" %d", dp[i]);
	}
	int flag = 1;
	for (int i = 0; i < n; i++)
		if (dp[ai[i]] == 0)
		{
			flag = 0; 
			break;
		}
	if (flag)
		printf("Yes");
	else
		printf("No");

	return 0;
}

信息

递交者
类型
递交
题目
P1002 hitwh 2019 新生赛 C cqsss and his enterprise
语言
C
递交时间
2020-12-24 20:29:27
评测时间
2020-12-24 20:29:27
评测机
分数
0
总耗时
25ms
峰值内存
244.0 KiB