文件名称:1-4
介绍说明--下载内容均来自于网络,请自行研究使用
Duck公司在仓库安装了红外报警装置,如图所示,所有红外线互不相交。n个发射器和n个接收器将平面分成n+1个区域,从左到右分别记作0、1、…、n。现在技术人员正在进行调试,对于每个点,需要快速知道它处于哪个区域。若正好处于红外线上,则视为处于右边的区域。
输入
第一行两个整数n、m,表示有n条直线、m个点
接下来n行,每行两个整数a、b,表示一组报警装置的发射器安装在(a, 0),接收器安装在(0, b)。每行a、b都比前一行的大
接下来m行,每行两个整数x、y,表示求点(x, y)所在的区域
输出
输出m行,每行一个数,对应每个点所在区域的编号(Duck installed infrared alarm in the warehouse, as shown in the figure, all infrared rays do not intersect. The n transmitters and n receivers divide the plane into n + 1 regions, denoted 0, 1, ..., n from left to right, respectively. Now technicians are debugging, for each point, you need to quickly know where it is located. If it is on the infrared, it is considered as the area to the right.)
输入
第一行两个整数n、m,表示有n条直线、m个点
接下来n行,每行两个整数a、b,表示一组报警装置的发射器安装在(a, 0),接收器安装在(0, b)。每行a、b都比前一行的大
接下来m行,每行两个整数x、y,表示求点(x, y)所在的区域
输出
输出m行,每行一个数,对应每个点所在区域的编号(Duck installed infrared alarm in the warehouse, as shown in the figure, all infrared rays do not intersect. The n transmitters and n receivers divide the plane into n + 1 regions, denoted 0, 1, ..., n from left to right, respectively. Now technicians are debugging, for each point, you need to quickly know where it is located. If it is on the infrared, it is considered as the area to the right.)
相关搜索: 二分查找
(系统自动生成,下载前可以参看下载内容)