mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-08 13:58:48 +00:00
P1047 [NOIP2005 普及组] 校门外的树
R63269725
This commit is contained in:
parent
d02a257205
commit
7cbea0786a
21
Luogu/P1047/P1047.cpp
Normal file
21
Luogu/P1047/P1047.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int l, m, u, v, ans;
|
||||
bool t[10005];
|
||||
|
||||
int main() {
|
||||
cin >> l >> m;
|
||||
for (int i = 0; i < m; i++) {
|
||||
cin >> u >> v;
|
||||
for (int j = u; j <= v; j++) {
|
||||
t[j] = true;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i <= l; i++) {
|
||||
ans += !t[i];
|
||||
}
|
||||
cout << ans << endl;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user