problem statement is here
#include<stdio.h>
int main(){
int a,i,j,k,h[100000],d,t,n,l;
scanf("%d",&a);
for(i=0;i<a;i++){
scanf("%d %d %d",&n,&t,&d);
for(j=0;j<n;j++){
scanf("%d",&h[j]);
}
l=0;
for(k=0;k<t;k++){
for(j=0;j<n;j++){
if(h[j]>d){
h[j]=h[j]-d;
l=l+1;
break;
}
}
}
if(l==t)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
#include<stdio.h>
int main(){
int a,i,j,k,h[100000],d,t,n,l;
scanf("%d",&a);
for(i=0;i<a;i++){
scanf("%d %d %d",&n,&t,&d);
for(j=0;j<n;j++){
scanf("%d",&h[j]);
}
l=0;
for(k=0;k<t;k++){
for(j=0;j<n;j++){
if(h[j]>d){
h[j]=h[j]-d;
l=l+1;
break;
}
}
}
if(l==t)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
No comments:
Post a Comment