记录详情

Accepted


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

代码

#include<bits/stdc++.h>
using namespace std;
const int maxn=1e4+10;
int n,m,K;
int f[maxn];
int main(){
    scanf("%d%d%d",&n,&m,&K);
    for(int i=1;i<=m;i++)f[i]=1;
    for(int i=m+1;i<=10000;i++){
        for(int j=1;j<=m;j++){
            bool flag=1;
            for(int k=1;k<=K;k++){
                if((i-j-k>=0)&&!f[i-j-k]){flag=0;break;}
            }
            if(flag){f[i]=1;break;}
        }
    }
    bool flag=1;
    for(int i=1,a;i<=n;i++)scanf("%d",&a),flag&=f[a];
    puts(flag?"Yes":"No");
    return 0;
}

信息

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