//目录

砍树,POJ(2665)

题目链接:http://poj.org/problem?id=2665

解题报告: 这里的区域没有重复,若有重复的话,模拟即可。

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

#define maxn 2000+10

using namespace std;
int main()
{
    long long m,n,st,ed;
    while(cin>>m>>n&&(m&&n))
    {
        while(n--)
        {
            cin>>st>>ed;
            m=m-(ed-st)-1;
        }
        cout<<m+1<<endl;
    }
    return 0;
}

 

posted @ 2016-04-17 18:33  小草的大树梦  阅读(267)  评论(0编辑  收藏  举报