Nanency @ 2023-02-01 18:55:37
#include<stdio.h>
int main(){
int l,m,u,v,a[10006],ans=0;
scanf("%d%d",&l,&m);
for(int i=0;i<=l;i++){
a[i]=1;
}//
for(int i=0;i<m;i++){
scanf("%d%d",&u,&v);
for(int j=u;j<=v;j++){
a[j]=0;
}
for(int i=0;i<=l;i++){
if(a[i]==1){
ans++; }
}
printf("%d",ans);
}
return 0;
}
by yujinning @ 2023-02-01 19:11:23
请自行估算时间复杂度
by zhan0518 @ 2023-03-02 12:08:15
@Nanency 有时间限制