Enton16 @ 2024-10-12 21:50:59
#include<string>
#include<iostream>
using namespace std;
int main()
{
int l,m,a;
a=0;
int u[10001],v[10001];
bool t[10001];
for(int n=0;n<=10000;n++) t[n]=0;
cin>>l>>m;
for(int i=0;i<m;i++) cin>>u[i]>>v[i];
for(int x=0;x<m;x++)
for(int y=u[x];y<=v[x];y++) t[y]=1;
for(int z=0;z<=10000;z++) if(t[z]==0) a++;
cout<<a;
}
by 1234aaa @ 2024-10-13 10:40:43
@Enton16 将倒数第2排10000改为l
by Enton16 @ 2024-10-19 22:45:55
@1234aaa
感谢!!!AC!!!以互关!
by Enton16 @ 2024-10-19 22:47:15
@1234aaa 为什么倒数第二排写10000就不行,不都是循环一定次数吗
by 1234aaa @ 2024-10-27 11:20:29
@Enton16 10000 越界了