liyangjida 2018-06-19 23:37:29
点我顶贴
收藏
删除
#include<iostream>
#include<algorithm>
using namespace std;
bool l[10001];
int M,L,start,end;
int main(){
cin >> L >> M;
for (int i = 0; i < M; ++i){
cin >> start >> end;
for (int i = start; i <= end; ++i) l[i] = true;
}
cout << count(l, l + L + 1, false);
return 0;
}