记录详情

Accepted


  
# 状态 耗时 内存占用
#1 Accepted 61ms 348.0 KiB
#2 Accepted 6ms 348.0 KiB
#3 Accepted 19ms 336.0 KiB
#4 Accepted 2ms 344.0 KiB
#5 Accepted 13ms 344.0 KiB
#6 Accepted 8ms 320.0 KiB
#7 Accepted 2ms 348.0 KiB
#8 Accepted 11ms 344.0 KiB
#9 Accepted 33ms 340.0 KiB
#10 Accepted 11ms 332.0 KiB
#11 Accepted 2ms 344.0 KiB
#12 Accepted 2ms 344.0 KiB
#13 Accepted 1ms 220.0 KiB

代码

#include <bits/stdc++.h> 
using namespace std;
const int N = 1e4 + 101; 
int n, m, k;
int a[N], dp[N];

int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for(int i = 1;i <= m; i++) dp[i] = 1;
	for(int i = m + 1;i <= k + 1; i++) dp[i] = 0;
	for(int i = max(m,k) + 2;i <= 10000; i++)
	{
		int flag = 0;
		for(int j = 1;j <= m; j++)
		{
			int flag2 = 0;
			for(int l = 1;l <= k; l++)
			{
				int las = i - j - l;
				if(las < 0) continue;
				if(!dp[las]) flag2 = 1;
			}
			if(!flag2) { flag = 1;break; } 
		}
		dp[i] = flag;
	}
    for(int i = 1;i <= n; i++) 
	{
	    scanf("%d",&a[i]);
	    if(!dp[a[i]]) { puts("No"); return 0; }
	}
	puts("Yes");
} 

信息

递交者
类型
递交
题目
P1002 hitwh 2019 新生赛 C cqsss and his enterprise
语言
C++
递交时间
2020-12-17 19:01:12
评测时间
2020-12-17 19:01:12
评测机
分数
100
总耗时
177ms
峰值内存
348.0 KiB