在VS上运行感觉没问题欸?求大神指点

P1047 [NOIP2005 普及组] 校门外的树

YN2005 @ 2024-12-16 17:15:43

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main()
{
    int l, n;
    scanf("%d %d", &l, &n);//输入马路的长度和区域的数目
    int s = l + 1;//计算总数目
    int a[10000];

    for (int i = 0;i < n;i++)
    {
        int c1 = 0;
        int c2 = 0;
        scanf("%d %d", &c1, &c2);
        for (int i = c1;c1 <= c2;c1++)
        {
            a[c1] = 0;
        }
    }

    int res = 0;
    for (int j = 0;j < 10000;j++)
    {
        if (a[j] == 0)
        {
            res++;
        }
    }

    s = s - res;

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

by dg114514 @ 2024-12-27 20:30:27

@YN2005int a[10001];


|