zhangluo @ 2024-12-10 21:47:39
#include<iostream>
using namespace std;
int main(){
int l=0;
int m=0;
cin>>l>>m;
int a[l+1]={0};
int u,v;
for(int i=1;i<=m;i++){
cin>>u>>v;
for(int j=u;j<=v;j++){
a[j]=1;
}
}
int cnt=0;
for(int i=1;i<=l;i++){
if(!a[i]){
cnt++;
}
}
cout<<cnt+1;
return 0;
}
by mcturtle @ 2024-12-10 21:55:42
@zhangluo
你把第一个测试点下载再if判断一下输入就行了
by friend_me @ 2024-12-10 21:56:18
@zhangluo
为什么
by HKW0202 @ 2024-12-10 21:56:19
数组要开到m+1吧
by friend_me @ 2024-12-11 18:46:20
@mcturtle癫
by zhangluo @ 2024-12-11 19:44:08
@friend_mecnt不加1只能对百分之30
by zhangluo @ 2024-12-11 19:46:37
@mcturtle,6,那我先就这么做