P1047 校门外的树
  • 板块学术版
  • 楼主lujunxian
  • 当前回复1
  • 已保存回复1
  • 发布时间2025/1/26 21:26
  • 上次更新2025/1/27 11:45:56
查看原帖
P1047 校门外的树
1367768
lujunxian楼主2025/1/26 21:26
#include<bits/stdc++.h>
using namespace std;
bool tree[10001];
int main()
{
	memset(tree,1,sizeof(tree)); 
	long long l,n,u[101],v[101];
	cin>>l>>n;
	for(int i=1;i<=n;i++)
		cin>>u[i]>>v[i];
	for(int i=1;i<=n;i++)
		for(int j=u[i];j<=v[i];j++)
			tree[j]=0;
	int ans=0;
	for(int i=1;i<=l;i++)
		if(tree[i]==1)
			ans++; 
	cout<<ans+1<<endl;
	return 0;
}

为什么90? 大佬求调

2025/1/26 21:26
加载中...