- 校门外的树
- 2016-01-23 21:17:40 @
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int l,m,a[105],b[105],s[10005],ans;
int main()
{
cin>>l>>m;
for (int i=1;i<=m;i++)
cin>>a[i]>>b[i];
memset(s,0,sizeof(s));
for (int i=0;i<=m;i++)
for (int j=1;j<=l;j++)
if (j>=a[i]&&j<=b[i])
s[j]=-1;
for (int i=0;i<=l;i++)
if(s[i]==0)
ans++;
cout<<ans;
return 0;
}
0 条评论
目前还没有评论...