_qumingnan_ @ 2024-08-31 17:20:16
#include<bits/stdc++.h>
using namespace std;
long n,m,a[114514],b=1,s,s1,i=1;
int main() {
cin>>n>>m;
for(int i=1; i<=m; i++) {
cin>>b>>s;
for(int j=b; j<=s; j++) {
a[j]++;
}
}
s=0;
for(int i=1; i<=n; i++) {
if(!a[i])s++;
}
cout<<s;
return 0;
}
by lzh_juruo @ 2024-08-31 17:23:32
@quminnan 数轴是从 0 到 n
by _qumingnan_ @ 2024-08-31 17:26:39
@lzh_juruo 谢谢大蛇
by _qumingnan_ @ 2024-08-31 17:28:47
A了A了