A. Little Nikita

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

The little boy Nikita was given some cubes as a present. He decided to build a tower out of them.

Initially, the tower doesn't have any cubes. In one move, Nikita either puts exactly 11 cube on top of the tower or removes exactly 11 cube from the top of the tower. Is it possible that after n𝑛 moves, the resulting tower has exactly m𝑚 cubes?

Input

Each test contains multiple test cases. The first line of input contains a single integer t𝑡 (1≤t≤1001≤𝑡≤100) — the number of test cases. The description of the test cases follows.

The only line of each test case contains two integers n𝑛 and m𝑚 (1≤n,m≤1001≤𝑛,𝑚≤100).

Output

For each test case, output "Yes" (without quotes) if Nikita can obtain a tower with m𝑚 cubes, and "No" (without quotes) otherwise.

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.

Example

input

Copy


  

3

3 3

2 4

5 3

output

Copy

Yes
No
Yes

Note

In the first test case, Nikita can put 11 cube on top of the tower 33 times in a row, so the answer is "Yes".

In the second test case, Nikita can only end up with either a tower with no blocks or a tower with 22 blocks, so the answer is "No".

解题说明:此题是一道模拟题,由于每次要么减去1要么加上1,为了确保最后正好为m个,首先确保个数不少于m,其次需要保证差值正好为2的整数倍。

#include<stdio.h>
int main()
{
	int t, i, n, m;
	scanf("%d", &t);
	for (i = 0; i < t; i++) 
	{
		scanf("%d %d", &n, &m);
		if (n < m) 
		{
			printf("No\n");
		}
		else if ((n - m) % 2 != 0) 
		{
			printf("No\n");
		}
		else
		{
			printf("Yes\n");
		}
	}
	return 0;
}

相关推荐

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-19 01:38:01       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-19 01:38:01       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-19 01:38:01       58 阅读
  4. Python语言-面向对象

    2024-07-19 01:38:01       69 阅读

热门阅读

  1. Ubuntu22,ROS2 colcon/cmake 编译卡死问题解决

    2024-07-19 01:38:01       20 阅读
  2. Mongodb文本索引

    2024-07-19 01:38:01       18 阅读
  3. ChatGPT:Stream 和 数据源

    2024-07-19 01:38:01       17 阅读
  4. 1.虚拟机相关的博文推荐

    2024-07-19 01:38:01       19 阅读
  5. Flink HA

    Flink HA

    2024-07-19 01:38:01      20 阅读
  6. vault正式环境安装部署

    2024-07-19 01:38:01       23 阅读
  7. 【Git】Git解除仓库关联或关联新仓库

    2024-07-19 01:38:01       18 阅读
  8. AIGC笔记--Classifer Guidance的代码理解

    2024-07-19 01:38:01       24 阅读
  9. rust 构建自己的库和模块

    2024-07-19 01:38:01       20 阅读
  10. 大语言模型系列-Transformer

    2024-07-19 01:38:01       24 阅读
  11. Git入门

    2024-07-19 01:38:01       25 阅读
  12. JVM高频面试题

    2024-07-19 01:38:01       23 阅读
  13. 割点(Articulation Point)

    2024-07-19 01:38:01       24 阅读