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 3
29 22
17 14
18 23
3 15
6 28
30 27
4 1
26 7
8 0
11 21
2 25
5 10
19 24

Sample Output

-6
4
4 这一题当时是第一个做的,并且一血使我们学校的一个队拿的,应该是道签到题吧 题意:给你n个点代表treasure的位置,然后再给你m个点,每给一个点时,都已这个点画一个十字架,其中位于第一部分和第三部分的是Wang的treasure共有p个,第二部分和第四部分是Dong的 共有q个,最终求他俩的差值即p-q;
#include<iostream>
#include<stdio.h>
#include<algorithm>
#define N 1100
using namespace std;
struct node
{
int x,y;
};
int main()
{
int n,m,i,j,x,y,p,q;
node a[N];
while(scanf("%d%d",&n,&m)!=EOF)
{
for(i=;i<n;i++)
{
scanf("%d%d",&a[i].x,&a[i].y);
}
for(i=;i<m;i++)
{
p=q=;
scanf("%d%d",&x,&y);
for(j=;j<n;j++)
{
if((a[j].x>x&&a[j].y>y)||(a[j].x<x&&a[j].y<y))//Wang的点的个数
p++;
else
q++;Dong的点的个数
}
printf("%d\n",p-q);
}
}
return ;
}

Distribution(F题)---第八届河南省程序设计大赛的更多相关文章

  1. 第八届河南省程序设计大赛-B.最大岛屿0000110011000000

    最大岛屿                                                                                           时间限制: ...

  2. NYOJ--1236--挑战密室(第八届河南省程序设计大赛)

    挑战密室 时间限制:1000 ms  |  内存限制:65535 KB 难度:4   描述 R组织的特工Dr. Kong 为了寻找丢失的超体元素,不幸陷入WTO密室.Dr. Kong必须尽快找到解锁密 ...

  3. nyoj 1239 引水project (河南省第八届acm程序设计大赛)

    题目1239 pid=1239" style="color:rgb(55,119,188)">题目信息 pid=1239" style="col ...

  4. nyoj1237 最大岛屿(河南省第八届acm程序设计大赛)

    题目1237 pid=1237" style="color:rgb(55,119,188)">题目信息 执行结果 本题排行 讨论区 最大岛屿 时间限制:1000 m ...

  5. nyoj 1238 最少换乘 (河南省第八届acm程序设计大赛)

    题目1238 题目信息 执行结果 本题排行 pid=1238" style="text-decoration:none; color:rgb(55,119,188)"&g ...

  6. NYOJ-712 探寻宝藏(第六届河南省程序设计大赛)

    探 寻 宝 藏 时间限制:1000 ms  |  内存限制:65535 KB 难度:5   描述 传说HMH大沙漠中有一个M*N迷宫,里面藏有许多宝物.某天,Dr.Kong找到了迷宫的地图,他发现迷宫 ...

  7. nyoj170 网络的可靠性(第三届河南省程序设计大赛)

    题目170 题目信息 执行结果 pid=170" style="text-decoration:none; color:rgb(55,119,188)">本题排行 ...

  8. 河南省第八届ACM程序设计大赛

    A:挑战密室 #include <iostream> #include <cstdio> #include <cstring> #include <algor ...

  9. 河南省第八届ACM程序设计大赛总结

    简单的对这次省赛做个总结:总体来说这个比赛过程中做的还算比较顺利,虽然中间多多少少遇到一些坑,正式比赛开始后,我们就开始找水题,当然了我首先把英文题目翻译了一遍,发现了一道水题,这道题目其实就是判断点 ...

随机推荐

  1. windows命令行下用netsh实现端口转发(端口映射)

    微软Windows的netsh是一个命令行脚本实用工具.使用netsh工具 ,可以查看或更改本地计算机或远程计算机的网络配置.不仅可以在本地计算机上运行这些命令,而且可以在网络上的远程计算机上运行. ...

  2. EventHandler中如何提升用户权限(模拟管理员权限)

    不论是在工作流或是EventHandler中,我们经常希望模拟管理员权限,从而可以通过程序自定义列表项的权限. 在工作流中可以用如下代码来提升权限:(以下代码实现的功能是断开列表项所继承的权限,除管理 ...

  3. 在 Linux 使用 GCC 编译C语言共享库

    对任何程序员来说库都是必不可少的.所谓的库是指已经编译好的供你使用的代码.它们常常提供一些通用功能,例如链表和二叉树可以用来保存任何数据,或者是一个特定的功能例如一个数据库服务器的接口,就像MySQL ...

  4. react native (一)

    开始接触app方面的工作,真心塞~ 又开始了周而复始的死磕一个问题专坐一整天的节奏,关键是还没有成绩,实在无语.╮(╯▽╰)╭,还是总结一下最近心塞历程吧-- react native中文网:http ...

  5. link常用的作用

    1 引入样式 2设置网页标题上面图标

  6. Xshell 5 免费版本安装过程

    发现本机的Xshell 5过期了用不了.在百度里搜索,下载安装后还是不可以使用.需要购买注册,后寻的一方法,分享给大家. 1.官网 进入官网,然后点击Download下方的Free License菜单 ...

  7. 批量更改数据库表架构(生成sql后直接执行!)

    批量更改数据库表架构(生成sql后直接执行!) use my_test; --当前数据库 ), ), ), @NewSql VARCHAR(max), @Index INT; SET @SchemaO ...

  8. m个苹果放入n个篮子

    题目 :X个相同的苹果放入Y个篮子,(1)篮子可以为空 ,篮子不同. 放法有C(X+Y-1,Y-1 );// (2)篮子不可以为空,篮子不同.放法有C(X-1,Y-1) //插挡板法 分析有了这个组合 ...

  9. git上传的文件夹为空的时候

    1,先删除空的文件夹 参考:https://www.cnblogs.com/wang715100018066/p/9694532.html 2,这个只能说是技巧不能说是方法,原理是在每个空文件夹新建一 ...

  10. 题目1460:Oil Deposit(递归遍历图)

    题目链接:http://ac.jobdu.com/problem.php?pid=1460 详解链接:https://github.com/zpfbuaa/JobduInCPlusPlus 参考代码: ...