求大佬帮忙。。。为什么我输出总是三位数啊

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

gongbengouyu @ 2019-10-03 16:22:50

include <stdio.h>

include <math.h>

int main() {

int i,n=0;
int a[10];
int high;
scanf("%d %d %d %d %d %d %d %d %d %d",&a[1],&a[2],&a[3],&a[4],&a[5],&a[6],&a[7],&a[8],&a[9],&a[10]);
scanf("%d",&high);
for(i=1;i<11;i++){
    if(high+30>a[i])
    n=n+1;
}
printf("%d",n);

}


by snowind @ 2019-10-03 16:24:17

希望更丰富的展现?使用Markdown


by FZzzz @ 2019-10-03 16:24:22

@gongbengouyu a[10]的下标是0到9


by xujian @ 2019-10-03 16:25:54

@gongbengouyu 开a[10]的话是不能用到a[10]的,只能用a[0]~a[9]


by fzhfzh @ 2019-10-03 16:26:07

希丰展?使MD


by snowind @ 2019-10-03 16:27:10

if(high+30>a[i])

这里是大于等于


by gongbengouyu @ 2019-10-03 16:27:50

@function_of_zero 感谢大佬!!!


by gongbengouyu @ 2019-10-03 16:31:56

@snowind 谢谢嗷!!


by fangjiacheng @ 2019-11-05 20:12:39

希望更丰富的展现?使用Markdown


|