'commit'
This commit is contained in:
23
TangDou/LuoGuBook/P1047_1.cpp
Normal file
23
TangDou/LuoGuBook/P1047_1.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
const int N = 10010;
|
||||
int b[N];
|
||||
int l;
|
||||
int m;
|
||||
|
||||
int cnt;
|
||||
|
||||
int main() {
|
||||
scanf("%d %d", &l, &m);
|
||||
while (m--) {
|
||||
int u, v;
|
||||
scanf("%d %d", &u, &v);
|
||||
for (int i = u; i <= v; i++) b[i]++;
|
||||
}
|
||||
for (int i = 0; i <= l; i++)
|
||||
if (b[i] == 0) cnt++;
|
||||
|
||||
printf("%d", cnt);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user