tj
2025-07-01 14:14:59
发布于:浙江
2阅读
0回复
0点赞
#include<iostream>
using namespace std;
bool a[100010];
int main(){
int l,m;
cin>>l>>m;
int tree=0;
for(int i=1;i<=m;i++){
int s,e;
cin>>s>>e;
for(int j=s;j<=e;j++){
a[j]=true;
}
}
for(int i=0;i<=l;i++){
if(a[i]==false){
tree++;
}
}
cout<<tree;
return 0;
}
这里空空如也
有帮助,赞一个