STEVEN0327 @ 2023-05-22 21:34:12
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,t,a,b,sum=0;
scanf("%d%d",&n,&t);
bool s[n];
fill(s,s+n,1);
for(int i=1;i<=t;i++)
{
scanf("%d%d",&a,&b);
for(int j=a-1;j<b;j++)
s[j]=0;
}
for(int i=0;i<n;i++)
if(s[i])
sum++;
printf("%d",sum+1);
return 0;
}
by Syncc @ 2023-05-22 21:40:54
需要特判一下
by STEVEN0327 @ 2023-07-01 13:52:37
@jinhouqi 3Q