解题思路:
注意事项:
参考代码:
#include<iostream>
using namespace std;
int main()
{
int L,M;
cin>>L>>M;
int qishi[100],zhongzhi[100];
for(int i=0;i<M;i++)
{
cin>>qishi[i]>>zhongzhi[i];
}
int shu[10000]; //to describe trees' situations
for(int i=0;i<=L;i++) //1 existed
{ //0 destroyed
shu[i]=1;
for(int j=0;j<M;j++)
{
if(i>=qishi[j]&&i<=zhongzhi[j])
{
shu[i]=0;
}
}
}
int out=0;
for(int i=0;i<=L;i++)
{
if(shu[i]==1)
{ out++;
}
}
cout<<out<<endl;
return 0;
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题8.8 (C语言代码)浏览:512 |
陈教主的三角形 (C语言代码)浏览:1082 |
格式化数据输出 (C语言代码)浏览:791 |
判定字符位置 (C语言代码)浏览:777 |
C语言程序设计教程(第三版)课后习题11.5 (C语言代码)浏览:969 |
C语言程序设计教程(第三版)课后习题9.6 (C语言代码)浏览:545 |
C语言程序设计教程(第三版)课后习题10.1 (C语言代码)浏览:736 |
【计算球体积】 (C语言代码)浏览:1410 |
C二级辅导-温度转换 (C语言代码)浏览:532 |
简单的a+b (C语言代码)浏览:528 |