huboxuan @ 2024-08-07 10:14:03
#include <bits/stdc++.h>
using namespace std;
int l,m,tree[1001],ans;
int main(){
scanf("%d %d",&l,&m);
for(int i=0;i<=l;i++){
tree[i]=1;
}
while(m--){
int beg,end;
scanf("%d%d",&beg,&end);
for(int i=beg;i<=end;i++){
tree[i]=0;
}
}
for(int i=0;i<=l;i++){
ans+=tree[i];
}
cout<<ans;
return 0;
}
by wizard(偷开O2 @ 2024-08-07 10:15:02
@huboxuan 程序没问题,数组往大开
by huboxuan @ 2024-08-07 10:17:14
为什么开大就行了呀
by huboxuan @ 2024-08-07 10:17:51
@wizard(偷开O2 为什么开大就行了呀
by wizard(偷开O2 @ 2024-08-07 10:19:05
@huboxuan 看数据范围,因为
by huboxuan @ 2024-08-07 10:20:04
@wizard(偷开O2 谢谢啦