首页 > 其他分享 >UVa 11498 Division of Nlogonia (water ver.)

UVa 11498 Division of Nlogonia (water ver.)

时间:2023-04-12 13:07:05浏览次数:60  
标签:Division ver puts division point water Nlogonia line 104


11498 - Division of Nlogonia

Time limit: 1.000 seconds

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2493

The Problem

After centuries of hostilities and skirmishes between the four nations living in the land generally known as Nlogonia, and years of negotiations involving diplomats, politicians and the armed forces of all interested parties, with mediation by UN, NATO, G7 and SBC, it was at last agreed by all the way to end the dispute, dividing the land into four independent territories.

It was agreed that one point, called division point, with coordinates established in the negotiations, would define the country division, in the following way. Two lines, both containing the division point, one in the North-South direction and one in the East-West direction, would be drawn on the map, dividing the land into four new countries. Starting from the Western-most, Northern-most quadrant, in clockwise direction, the new countries will be called Northwestern Nlogonia, Northeastern Nlogonia, Southeastern Nlogonia and Southwestern Nlogonia.




The UN determined that a page in the Internet should exist so that the inhabitants could check in which of the countries their homes are. You have been hired to help implementing the system.

The Input

The input contains several test cases. The first line of a test case contains one integer K indicating the number of queries that will be made (0 < K ≤ 103). The second line of a test case contains two integers Nand M representing the coordinates of the division point (-104 < N, M < 104). Each of the K following lines contains two integers X and Y representing the coordinates of a residence (-104 ≤ X, Y ≤ 104).

The end of input is indicated by a line containing only the number zero.

The Output

For each test case in the input your program must print one line containing:

  • the word divisa
  • NO
  • NE
  • SE
  • SO

Sample Input


3
2 1
10 10
-10 1
0 33
4
-1000 -1000
-1000 -1000
0 0
-2000 -10000
-999 -1001
0


Sample Output


NE
divisa
NO
divisa
NE
SO
SE



完整代码:

/*0.015s*/

#include <cstdio>

int main()
{
	int k, N, M, x, y;
	while (scanf("%d", &k), k)
	{
		scanf("%d%d", &N, &M);
		while (k--)
		{
			scanf("%d%d", &x, &y);
			if (x == N || y == M) puts("divisa");
			else if (x > N && y > M) puts("NE");
			else if (x < N && y > M) puts("NO");
			else if (x > N && y < M) puts("SE");
			else puts("SO");
		}
	}
	return 0;
}




标签:Division,ver,puts,division,point,water,Nlogonia,line,104
From: https://blog.51cto.com/u_5535544/6185475

相关文章

  • UVa 11723 Numbering Roads (water ver.)
    11723-NumberingRoadsTimelimit:1.000secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2823Inmycountry,streetsdon’thavenames,eachofthemarejustgivenanumber......
  • UVa 457 Linear Cellular Automata (water ver.)
    457-LinearCellularAutomataTimelimit:3.000secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=show_problem&problem=398AbiologistisexperimentingwithDNAmodificationofbacterialcolonies......
  • UVa 10783 Odd Sum (water ver.)
    10783-OddSumTimelimit:3.000secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=19&page=show_problem&problem=1724Givenarange [a, b],youaretofindthesummationofalltheoddintegersinthisran......
  • sqlserver 使用脚本创建作业 (by me)
    usemastergo--定义创建作业DECLARE@jobiduniqueidentifier,@jobnamesysnameSET@jobname=N'testInterval'IFEXISTS(SELECT*FROMmsdb.dbo.sysjobsWHEREname=@jobname)EXECmsdb.dbo.sp_delete_job@[email protected]_add_job@job_......
  • 【Serverless】云数据库端云一体化问题
     【关键字】AGC、HarmonyOS、端云一体化 【问题描述】开发者反馈在鸿蒙应用集成了AGC云数据库服务,在引入AGC服务时遇到了一些问题。具体如下所述:1、HarmonyOSArkTS语言开发,参数是number类型,但是查询的云数据库字段是Integer类型,这要怎么处理。2、样例中querybook的字段b......
  • SpringBoot 集成 MybatisPlus 六——ActiveRecord 增、删、改
    1向表中插入记录1.1插入所有列在创建实体对象时,指定所有字段的内容,包括ID列。@TestpublicvoidtestAddUser(){Useruser=newUser(20,"成吉思汗","男","一代天骄");booleanres=user.insert();System.out.println(res);}调用MyBatisPlus时,后台执行的......
  • 第九篇 手写原理代码 - 数组 【 实现 forEach、map、filter、every、some 】
    1、forEachArray.prototype.my_forEach=function(callback){for(leti=0;i<this.length;i++){callback(this[i],i,this);}};2、mapArray.prototype.my_map=function(callback){constarr=[];for(leti=0;i<this.length;......
  • 广州大学第十七届ACM大学生程序设计竞赛 L. 因子模仿 - hard version 线段树维护矩阵
    传送门大致思路:  观察发现,茉美香胜利会叠加对手所有状态,茉美香失败会被对手叠加所有状态。我们可以用矩阵[a1,a2,b1,b2]表示两个人的状态(其中a1,a2表示茉美香,b1,b2表示对手)茉美香赢了之后的状态是[a1+b1,a2+b2,b1,b2],茉美香输了之后的状态是[a1,b1,a1+b1,......
  • DBeaver安装与使用教程(超详细安装与使用教程),好用免费的数据库管理工具
    文章原链接http://t.csdn.cn/Jf4QN       ......
  • Docker CLI docker compose convert常用命令
    Docker是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的镜像中,然后发布到任何流行的Linux或Windows操作系统的机器上,也可以实现虚拟化。Docker是内核虚拟化,不使用Hypervisor是不完全虚拟化,依赖内核的特性实现资源隔离。本文主要介绍DockerCLI中d......