why???

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

hgggggg @ 2023-08-06 17:38:07

#include<bits/stdc++.h>
using namespace std;
int main()

    {
    int a[1001],b[10001];
    int h=0;
    int n,m;
    cin>>n>>m;
    int u=2*m;  
    for(int y=0;y<=n;y++)
    {
        a[y]=0;
    }
    for(int i=1;i<=u;i++)
    {
        cin>>b[i];
    }
    while((u-2)>=0)
    {
        for(int j=b[u-1];j<=b[u];j++)
        a[j]=1;
        u=u-2;
    }
    for(int p=0;p<=n;p++)
    {
        if(a[p]=0)
        h++;

    }
    cout<<h;
    return 0;

}

by hgggggg @ 2023-08-06 17:38:18

why


by Heartstrings @ 2023-08-06 17:43:40

你让我们干啥你说清楚啊


by hgggggg @ 2023-08-06 17:44:51

@lonely_conqueror 就想让你们看看这个思路为啥不对


by Heartstrings @ 2023-08-06 17:46:04

@hgggggg 你要说清楚错误原因是WA还是TLE什么的啊


by hgggggg @ 2023-08-06 17:47:08

@lonely_conqueror 错的结果


by Heartstrings @ 2023-08-06 17:47:48

@hgggggg ???WA?


by hgggggg @ 2023-08-06 17:47:49

@lonely_conqueror 就这个思路为啥得不出正确的结果,


by Heartstrings @ 2023-08-06 17:50:20

@hgggggg 你这个思路好新奇

正常人的输入不应该是分2个数组的吗


by hgggggg @ 2023-08-06 17:52:57

@lonely_conqueror 应该没问题的吧


by dsfgsdf @ 2023-08-06 17:53:20

@hgggggg

你这新奇的思路一定能AKIOI....


| 下一页