/*POJ2808 校门外的树 program2.3.cpp*/
#include<cstdio>
#include<cstring>
const int maxlen = 10001;
int main(void)
{
int m, n, l, k;
int a[maxlen];
while(scanf("%d%d", &m, &n) != EOF)
{
memset(a, 0, sizeof(a));
while(n--)
{
scanf("%d%d", &l, &k);
for(int i = l; i <= k; i++)
{
a[i] = 1;
}
}
}
int cnt = 0;
for(int j = 0; j <= m; j++)
{
if(a[j] == 0)
cnt++;
}
printf("%d\n", cnt);
return 0;
}
poj2808校门外的树
最新推荐文章于 2022-07-07 09:36:05 发布