xiexiaoyuawa @ 2022-12-13 15:42:24
刚入洛谷两三天的萌新,1-3崩后面过
#include<bits/stdc++.h>
using namespace std;
int main(){
int l,m,s;
cin>>l>>m;
int u[m],v[m],t[l];
for(int i = 0;i < l;i++)t[i] = 1;
for(int i = 0;i < m;i++){
cin>>u[i]>>v[i];
for(int j = u[i];j < v[i]+1;j++){
t[j] = 0;
}
}
for(int i = 0;i < l;i++){
if(t[i])s++;
}
cout<<s+1;
return 0;
}
by Night_sea_64 @ 2022-12-13 16:03:57
@xiexiaoyuawa 要把
by xiexiaoyuawa @ 2022-12-13 20:45:08
@Netherite_sword_666 谢大佬指点