首页 > 其他分享 >第八届河南省赛 zzuoj 10411: F.Distribution (模拟)水

第八届河南省赛 zzuoj 10411: F.Distribution (模拟)水

时间:2023-04-28 11:02:19浏览次数:48  
标签:map Wang 10411 int zzuoj Dong Distribution line treasures


10411: F.Distribution


Time Limit: 1 Sec   Memory Limit: 128 MB

Submit: 10  

Solved: 7

[

Submit][

Status][

Web Board]


Description


One day , Wang and Dong in the Dubai desert expedition, discovered an ancient castle. Fortunately, they found a map of the castle.The map marks the location of treasures.

They agreed to distribute the treasures according to the following rules:

Wang draws a horizontal line on the map and then Dong draws a vertical one so that the map is divided into 4 parts, as show below.   

II                              I

 


III                             IV

 


Wang will save the treasures in I and III ,while those situated in II and IV will be taken away by Dong. Wang first draw a horizontal line, Dong after the draw a vertical line.

They drew several pairs of  lines. For each pair, Wang wants to know the difference between their treasures.

It's guaranteed that all the reasures will lie on neither of the lines drew by them.


Input


One day , Wang and Dong in the Dubai desert expedition, discovered an ancient castle. Fortunately, they found a map of the castle.The map marks the location of treasures.

They agreed to distribute the treasures according to the following rules:

Wang draws a horizontal line on the map and then Dong draws a vertical one so that the map is divided into 4 parts, as show below.   

II                              I

 


III                             IV

 


Wang will save the treasures in I and III ,while those situated in II and IV will be taken away by Dong. Wang first draw a horizontal line, Dong after the draw a vertical line.

They drew several pairs of  lines. For each pair, Wang wants to know the difference between their treasures.

It's guaranteed that all the reasures will lie on neither of the lines drew by them.


Output


Output  contains   lines , a single line with a integer , the difference described above.


Sample Input


10 329 2217 1418 233 156 2830 274 126 78 011 212 255 1019 24


Sample Output


-644


HINT

Source


第八届河南省赛

#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
struct zz
{
    int x;
    int y;
}q[210];
int main()
{
    int n,m;
    int x,y;
    int i,j;
    int a,b;
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        for(i=0;i<n;i++)
            scanf("%d%d",&q[i].x,&q[i].y);
        while(m--)
        {
            a=b=0;
            scanf("%d%d",&x,&y);
            for(i=0;i<n;i++)
            {
                if((q[i].x<x&&q[i].y>y)||(q[i].x>x&&q[i].y<y))
                    a++;
            }
            b=n-a;
            printf("%d\n",b-a);
        }
    }
    return 0;
}




标签:map,Wang,10411,int,zzuoj,Dong,Distribution,line,treasures
From: https://blog.51cto.com/u_16079508/6233585

相关文章