求大佬帮忙第十个总过不去

P1046 [NOIP2005 普及组] 陶陶摘苹果

Q804401842 @ 2021-11-12 21:42:29

include"stdio.h"

int main(){
    int a[10],i,j;
    int max;

    for(i=0;i<10;i++){
        scanf("%d",&a[i]);
    }
    scanf("%d",&max);
    max=max+30;

    for(i=0;i<10;i++){
        if(a[i]<max)
        j++;
    }

    printf("%d",j);

    return 0;
}

by ningago @ 2021-11-12 21:45:49

<改成<=看看

if(a[i]<=max)

by Mr_ll @ 2021-11-12 21:46:31

首先,j初值为0(j=0) ,其次,a[i]<=max,=可以取


by 力巴尔 @ 2021-11-12 21:46:41

@Q804401842 把

if(a[i]<max)

改成

if(a[i]<=max)

by greenhb @ 2021-11-12 21:48:30

把第13行第小于改成小于等于,注意题中说假设淘淘的手碰到苹果就会掉下来```cpp

include<stdio.h>

int main(){ int a[10],i,j; int max;

for(i=0;i<10;i++){
    scanf("%d",&a[i]);
}
scanf("%d",&max);
max=max+30;

for(i=0;i<10;i++){
    if(a[i]<=max)
    j++;
}

printf("%d",j);

return 0;

}


by 力巴尔 @ 2021-11-12 22:06:05

@Q804401842 你自己发的提问贴,都不关注一下,别人回复你,你既不回复也不改代码再提交,那你问了有什么意义呢


by batmanzhan @ 2022-01-19 17:57:17

if(a[i]<=max)


|