为什么会有一个红色?其他都是AC

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

twilightMUMU @ 2023-10-24 22:51:28

如下

#include <stdio.h>

int main() {
    int A[10];
    int B, i;
    for (i = 0; i < 10; i++)
        scanf("%d ", &A[i]);

    scanf("%d", &B);

    int k = 0;
    for (i = 0; i < 10; i++) {
        if (A[i] < B + 30)
            k++;
    }

    printf("%d", k);
    return 0;
}

by zsjaaaxyzgfwpl1314 @ 2023-10-24 23:00:29

if (A[i] < B + 30)

改为

if (A[i] <=B + 30)

by zsjaaaxyzgfwpl1314 @ 2023-10-24 23:01:15

@twilightMUMU


by ccjjxx @ 2023-10-24 23:48:48

if 要有等于号


|