C语言,只有10分,大神别喷

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

留恋 @ 2017-05-18 13:41:28

#include <stdio.h>
#include <stdlib.h>
int main()
{
    int x,c,v,m=0,a[20],b; 
    for(x=0;x<20;x++)
    {
        scanf("%d",&a[x]);
    }
    scanf("%d",&b);
    for(v=0;v<=20;v++)
    {
        if(b+30>=a[v])
        {
            m++;
        }
    }
    printf("%d",m-1); 
   system("pause");
   return 0;
}

by 留恋 @ 2017-05-18 13:48:03

#include <stdio.h>
#include <stdlib.h>
int main()
{
    int x,c,v,m=0,a[10],b; 
    for(x=0;x<10;x++)
    {
        scanf("%d",&a[x]);
    }
    scanf("%d",&b);
    for(v=0;v<=10;v++)
    {
        if(b+30>=a[v])
        {
            m++;
        }
    }
    printf("%d",m-1); 
   system("pause");
   return 0;
}
刚刚搞错了是10个,可为什么0分

by 户山香澄 @ 2017-05-18 15:31:49

把system("pause")去掉 @留恋


by 户山香澄 @ 2017-05-18 15:32:59

然后把输出里面的m-1改成m


by gcrx @ 2017-08-07 22:08:11

v不能<=10,要<=9或<10


by gcrx @ 2017-08-14 22:10:22

第二个


|