CF2227A.Koshary
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Yousef is at the coordinates (0,0) and wants to reach a plate of Koshary at (x,y).
To get there, Yousef takes long steps. From any point (a,b), a long step moves him to:
- (a+2,b) or (a,b+2)
However, Yousef is allowed to take at most one short step during his entire journey. A short step moves him to:
- (a+1,b) or (a,b+1)
Can Yousef reach the exact coordinates (x,y) of the Koshary plate?
优素福位于坐标 (0,0),他想要到达位于 (x,y) 的一盘库沙里(Koshary)。
为了到达那里,优素福迈的是长步。从任意点 (a,b) 出发,一步长步可将他移动至:
- (a+2,b) 或 (a,b+2)
然而,优素福在整个行程中最多只能走一步短步。一步短步可将他移动至:
- (a+1,b) 或 (a,b+1)
优素福能否恰好到达库沙里盘子所在的坐标 (x,y)?
输入格式
The first line contains an integer t (1≤t≤100) — the number of test cases.
Each test case contains two integers x and y (1≤x,y≤10) — the coordinates of the Koshary plate.
第一行包含一个整数 t(1≤t≤100)——测试用例的数量。
每个测试用例包含两个整数 x 和 y(1≤x,y≤10)——Koshary 盘子的坐标。
输出格式
For each test case, output "YES" if Yousef can reach the Koshary plate and "NO" otherwise.
You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.
对于每个测试用例,如果优素福能够到达Koshary餐盘,则输出“YES”;否则输出“NO”。
您可以以任意大小写形式输出答案(大写或小写)。例如,字符串“yEs”、“yes”、“Yes”和“YES”均会被识别为肯定回答。
输入输出样例
输入#1
6 1 1 1 2 4 6 5 9 7 2 10 10
输出#1
NO YES YES NO YES YES
说明/提示
In the first test case, it is impossible to reach (1,1) using the mentioned steps.
In the second test case, an optimal sequence of steps would be: $$(0, 0) \xrightarrow{\texttt{long}} (0, 2) \xrightarrow{\texttt{short}} (1, 2)$$
In the third test case, an optimal sequence of steps would be: $$(0, 0) \xrightarrow{\texttt{long}} (0, 2) \xrightarrow{\texttt{long}} (2, 2) \xrightarrow{\texttt{long}} (2, 4) \xrightarrow{\texttt{long}} (4, 4) \xrightarrow{\texttt{long}} (4, 6)$$
在第一个测试用例中,无法通过题目所述的步骤到达点 (1,1)。
在第二个测试用例中,一个最优的步骤序列为:
(0,0)long(0,2)short(1,2)
在第三个测试用例中,一个最优的步骤序列为:
(0,0)long(0,2)long(2,2)long(2,4)long(4,4)long(4,6)
输入解题思路,AI测评打分。不知道怎么写?