mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
32 lines
397 B
C++
32 lines
397 B
C++
|
|
#include<stdio.h>
|
|
#include<stdlib.h>
|
|
#include<iostream>
|
|
|
|
using namespace std;
|
|
|
|
int main(void){
|
|
bool aa[10002];
|
|
long i,j;
|
|
long a,b;
|
|
long l,m;
|
|
cin>>l>>m;
|
|
for(i = 0; i <= l; i++){
|
|
aa[i] = true;
|
|
}
|
|
for(i = 0; i < m; i++){
|
|
cin>>a>>b;
|
|
for(j = a; j <= b; j++){
|
|
aa[j] = false;
|
|
}
|
|
}
|
|
j = 0;
|
|
for(i = 0; i <= l; i++){
|
|
if(aa[i]){
|
|
j++;
|
|
}
|
|
}
|
|
cout<<j;
|
|
// system("pause");
|
|
return 0;
|
|
} |