A. Prime Subtraction

time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

You are given two integers xx and yy (it is guaranteed that x>yx>y). You may choose any prime integer pp and subtract it any number of times from xx. Is it possible to make xx equal to yy?

Recall that a prime number is a positive integer that has exactly two positive divisors: 11 and this integer itself. The sequence of prime numbers starts with 22, 33, 55, 77, 1111.

Your program should solve tt independent test cases.

Input

The first line contains one integer tt (1≤t≤10001≤t≤1000) — the number of test cases.

Then tt lines follow, each describing a test case. Each line contains two integers xx and yy (1≤y<x≤10181≤y<x≤1018).

Output

For each test case, print YES if it is possible to choose a prime number pp and subtract it any number of times from xx so that xx becomes equal to yy. Otherwise, print NO.

You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes, and YES will all be recognized as positive answer).

Example

input

Copy

4
100 98
42 32
1000000000000000000 1
41 40

output

Copy

YES
YES
YES
NO

Note

In the first test of the example you may choose p=2p=2 and subtract it once.

In the second test of the example you may choose p=5p=5 and subtract it twice. Note that you cannot choose p=7p=7, subtract it, then choose p=3p=3 and subtract it again.

In the third test of the example you may choose p=3p=3 and subtract it 333333333333333333333333333333333333 times.

解题说明:此题是一道数学题,要求判断x-kp是否等于y,其中p为素数。由于每个数不是素数就是素数的倍数,所以除非x-y=1,否则肯定能找到这样的数。

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

int main()
{
	int k;
	long long x, y;
	scanf("%d", &k);
	while (k--)
	{
		scanf("%lld %lld", &x, &y);
		if (x - y == 1)
		{
			printf("NO\n");
		}
		else
		{
			printf("YES\n");
		}
	}
	return 0;
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值