样例和1自运行都可以过,但是0分,求

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

sssr_9 @ 2023-11-05 17:38:38

#include<stdio.h>
int main()
{
    int a,b,i,h,g;
    scanf("%d%d",&a,&b);
    int s[10000]={0};
    int t[200]={0};
    for(i=0;i<2*b;i++){
        scanf("%d",&t[i]);
    }
    for(i=0;i<b;i++){
        h=t[2*i];
        for(h=h;h<=t[2*i+1];h++){
            s[h]=1;
        }
    }
    for(i=0;i<=a;i++){
        if(s[i]==1);
        else g++;
    }
    printf("%d",g);
    return 0;
}

by 2021zjhs005 @ 2023-11-05 17:43:02

@sssr_9


by sssr_9 @ 2023-11-05 17:48:49

@2021zjhs005 谢谢,是我粗心了,还纠结了好久。


|