0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-09-16 20:05:26 +00:00

P1047 [NOIP2005 普及组] 校门外的树

R63269725
This commit is contained in:
Baoshuo Ren 2021-11-21 14:51:47 +08:00 committed by Baoshuo Ren
parent d02a257205
commit 7cbea0786a
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

21
Luogu/P1047/P1047.cpp Normal file
View 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;
}