| 记录编号 | 590042 | 评测结果 | AAAAAAAAAA | ||
|---|---|---|---|---|---|
| 题目名称 | 973.[NOIP 2005]校门外的树 | 最终得分 | 100 | ||
| 用户昵称 | 是否通过 | 通过 | |||
| 代码语言 | C++ | 运行时间 | 0.000 s | ||
| 提交时间 | 2024-07-09 14:52:47 | 内存使用 | 0.00 MiB | ||
#include<bits/stdc++.h>
using namespace std;
int main()
{
freopen("tsuri.in","r",stdin);
freopen("tsuri.out","w",stdout);
int L,M,s=0,x,y;
cin>>L>>M;
bool t[10001];
for(int i=0;i<=L;i++)
t[i]=true;
for(int i=1;i<=M;i++){
cin>>x>>y;
for(int j=x;j<=y;j++)
t[j]=false;
}
for(int i=0;i<=L;i++)
if(t[i]) s++;
cout<<s;
return 0;
}