akldjdj @ 2024-02-28 20:18:07
#include<iostream>
using namespace std;
int main(){
int a[100001]={0};
int l=0,m=0,u=0,v=0,count=0;
cin>>l>>m;
for(int i=1;i<=l;i++){
a[i]=1;
}
for(int i=0;i<m;i++){
cin>>u>>v;
for(int i=u;i<=v;i++){
a[i]=0;
}
}
for(int i=1;i<=l;i++){
if(a[i]==1)count++;
}
cout<<count;
}
by qym110809 @ 2024-02-28 20:20:37
请注意
by qym110809 @ 2024-02-28 20:20:46
@akldjdj
by akldjdj @ 2024-02-28 20:28:56
@qym110809 谢谢 解决了