#Z02201. 坐标系位置判定

坐标系位置判定

题目描述

给定两点 A 和 B,以 A 为原点,向量 AB 方向为 x 轴正方向建立直角坐标系。现有 q 个查询点 Pi,按以下规则输出位置编码:

			0:与原点 A 重合 (x = 0, y = 0) 
		
		
			x:位于 x 轴上 (y = 0, x != 0) 
		
		
			y:位于 y 轴上 (x = 0, y != 0) 
		
		
			1:第一象限 (x > 0, y > 0) 
		
		
			2:第二象限 (x  0) 
		
		
			3:第三象限 (x  
		
		
			4:第四象限 (x > 0, y  
		
	
	
		注:判断优先级从上至下执行,坐标轴不包含原点。
	



.prd {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
}
.ip-s {
  background-color: #f8f9fa;
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 16px;
}
.input-section ol {
  padding-left: 24px;
  margin: 12px 0;
}
.ip-f {
  font-family: 'Consolas', monospace;
  background-color: #e9ecef;
  padding: 2px 4px;
  border-radius: 3px;
}
.var {
  font-style: italic;
  color: #007bff;
}
.priority-note {
  color: #666;
  font-size: 0.9em;
  margin-top: 8px;
}
sub {
  vertical-align: sub;
  font-size: 0.8em;
}

输入格式

第一行包含两个点的整数坐标: Ax Ay Bx By

		第二行包含查询次数 q 
	
	
		接下来 q 行,每行包含一个查询点的整数坐标:

Px Py

	所有数据都是整数并且保证在-1e5到1e5内,q在1到1e5内



    .prd { 
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
        line-height: 1.6; color: #333; 
    } 
    .ip-s { 
        background-color: #f8f9fa; padding: 12px 16px; 
        border-radius: 4px; margin-bottom: 16px; 
    } 
    .ip-s ol { 
        padding-left: 24px; margin: 0; 
    } 
    .ip-f { 
        font-family: 'Consolas', monospace; 
        background-color: #e9ecef; 
        padding: 2px 4px; border-radius: 3px; 
    } 
    .var { font-style: italic; color: #007bff; } 
    sub { vertical-align: sub; font-size: 0.8em; } 

.priority-note { color: #666; font-size: 0.9em; margin-top: 8px; }

输出格式

输出 q 行,每行一个字符表示位置编码:

			0:与原点重合
		
		
			x:x轴上
		
		
			y:y轴上
		
		
			1:第一象限
		
		
			2:第二象限
		
		
			3:第三象限
		
		
			4:第四象限

.problem-description { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; line-height: 1.6; color: #333; } .output-section { background-color: #f8f9fa; padding: 12px 16px; border-radius: 4px; margin-bottom: 16px; } .output-format { padding-left: 24px; margin: 12px 0; list-style-type: none; } .output-format li { margin-bottom: 6px; } .input-format { display: inline-block; width: 20px; font-family: 'Consolas', monospace; background-color: #e9ecef; padding: 2px 4px; border-radius: 3px; text-align: center; font-weight: bold; color: #c71585; } .var { font-style: italic; color: #007bff; }

0 0 2 0
7
0 0
1 1
-1 1
-1 -1
1 -1
1 0
0 1
0
1
2
3
4
x
y