Accepted
foo.cc: In function 'int main()': foo.cc:7:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d%d",&n,&m,&k); ~~~~~^~~~~~~~~~~~~~~~~~~ foo.cc:24:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&a); ~~~~~^~~~~~~~~
正在同步测试数据,请稍后
代码
#include<bits/stdc++.h>
#define N 10001
using namespace std;
int n,m,k,flag;
int a,ans[N],v[N];
int main(){
scanf("%d%d%d",&n,&m,&k);
for(int i = 1; i <= m; i++) v[i] = 1;
for(int i = m + 1; i < N; i++){
for(int j = 1; j <= m; j++){
flag = 0;
for(int l = 1; l <= k; l++)
if(!v[i - j - l]){
flag = 1;
break;
}
if(!flag){
v[i] = 1;
break;
}
}
}
for(int i = 1; i <= n; i++){
scanf("%d",&a);
if(!v[a]){
printf("No\n");
exit(0);
}
}
printf("Yes\n");
return 0;
}
信息
- 递交者
- 类型
- 递交
- 题目
- P1002 hitwh 2019 新生赛 C cqsss and his enterprise
- 语言
- C++
- 递交时间
- 2020-12-21 18:12:56
- 评测时间
- 2020-12-21 18:12:56
- 评测机
- 分数
- 100
- 总耗时
- 29ms
- 峰值内存
- 384.0 KiB