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 Heartstrings @ 2023-08-06 18:16:44
首先
其次我们把所有需要的砍掉的树打上标记(
最后我们把所有要砍掉的树枚举一下就好了
by Heartstrings @ 2023-08-06 18:17:05
@hgggggg 人呢
by Heartstrings @ 2023-08-06 18:17:28
求关
by hgggggg @ 2023-08-06 18:20:54
@lonely_conqueror 其实我大神,想你帮我的code纠一下错,谢谢
by hgggggg @ 2023-08-06 18:21:16
@lonely_conqueror 谢谢你哟
by Heartstrings @ 2023-08-06 18:21:55
@hgggggg 6
by hgggggg @ 2023-08-06 18:24:20
@lonely_conqueror 其实我大神里面不小心打了一个我字,不好意思呀,让你误解了
by hgggggg @ 2023-08-06 18:25:13
@lonely_conqueror sorry for my carelessness
by hgggggg @ 2023-08-06 18:28:57
@lonely_conqueror 大神,help me
by hgggggg @ 2023-08-06 18:30:11
有大神救救我吗