http://acm.hdu.edu.cn/showproblem.php?pid=4079

比大小的题。。。没用条件给一堆。。。

View Code
#include <iostream>
#include <map>
#include <string>
#include <algorithm>
using namespace std;
typedef struct L{
    int start,during;
}L;
L phone[11000];
int main()
{
    int n,m,i,j;
    int start,during;
    int ans;
    while(scanf("%d%d",&n,&m),(n||m))
    {
        for(i=0;i<n;i++)
            scanf("%*d%*d%d%d",&phone[i].start,&phone[i].during);
        for(i=0;i<m;i++)
        {
            ans=0;
            scanf("%d%d",&start,&during);
            for(j=0;j<n;j++)
            {
                if(phone[j].start<start&&phone[j].start+phone[j].during>start)
                    ans++;
                if(phone[j].start>start&&start+during>phone[j].start)
                    ans++;
                if(phone[j].start==start)
                    ans++;
            }
            printf("%d\n",ans);
        }
    }
    return 0;
}