ZiruiLIU @ 2024-02-01 18:03:34
测试点
#include<bits/stdc++.h>
using namespace std;
int l,m,a[110],b,c,s;
int main(){
cin>>l>>m;
for(int i=1;i<=m;i++)
{
int head,tail;
cin>>head>>tail;
for(int j=head;j<=tail;j++)
if(a[j]==0)
a[j]=1;
}
for(int i=0;i<=l;i++)
{
if(a[i]==0)
s++;
}
cout<<s-1;
return 0;
}
by ZiruiLIU @ 2024-02-01 18:07:47
编译测试都对,全抄的题解,洛谷下载的测试点也对。
by damnM3bro @ 2024-02-01 18:07:48
请注意数据范围,再把数组开大一些,开到1005.
by cao_20115 @ 2024-02-28 20:59:49
@HU_ruixi 1005不够,要10005!