help!! 为咩一分没有,蚌埠住了,佬,浇浇

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

Rookie_1st @ 2023-07-04 19:19:49

#include<stdio.h>
int main()
{
    int i=0,k=0,m=0,a[10]={0};
    for (i=0;i<10;i++)
    {
        scanf("%4d",&a[i]);
    }
    scanf("%d",&k);
    k=k+30;
    for (i=0;i<10;i++)
    {
        if(a[i]<=k)
        {
            m++;
        }
    }
    printf("%4d",m);
    return 0;
}

by yzm0325 @ 2023-07-04 19:23:01

@Rookie_1st 请告诉我为什么输出要补足四位


by Masna_Kimoyo @ 2023-07-04 19:27:34

@zym0325 要不要来帮帮我


by chensiru @ 2023-07-04 19:35:01

#include<stdio.h>
int main()
{
    int i=0,k=0,m=0,a[10]={0};
    for (i=0;i<10;i++)
    {
        scanf("%d",&a[i]);
    }
    scanf("%d",&k);
    k=k+30;
    for (i=0;i<10;i++)
    {
        if(a[i]<=k)
        {
            m++;
        }
    }
    printf("%d",m);
    return 0;
}

by chensiru @ 2023-07-04 19:35:32

@Masna_Kimoyo


by Rookie_1st @ 2023-07-04 19:36:13

@zym0325 三位数加一个空格or回车?


by Masna_Kimoyo @ 2023-07-04 19:36:29

@chensiru ?


by GWTPEL @ 2023-07-04 19:36:34

最后输出m错了


by yzm0325 @ 2023-07-04 19:38:16

@Rookie_1st 你为什么要补,请指出题里关于输出要补位的部分


by Rookie_1st @ 2023-07-04 19:39:19

@zym0325 去掉4也一样不行)


by Rookie_1st @ 2023-07-04 19:40:41

@herie 能细说一下嘛)


| 下一页