Educational Codeforces Round 74 (Rated for Div. 2) A. Prime Subtraction

心不动则不痛 提交于 2019-12-01 12:34:05

链接:

https://codeforces.com/contest/1238/problem/A

题意:

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

Recall that a prime number is a positive integer that has exactly two positive divisors: 1 and this integer itself. The sequence of prime numbers starts with 2, 3, 5, 7, 11.

Your program should solve t independent test cases.
思路:
考虑大于1的素数可以用素数补充, 合数都是素数的倍数也可以.

代码:

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

LL x, y;

int main()
{
        int t;
        cin >> t;
        while (t--)
        {
                cin >> x >> y;
                 if (x-y == 1)
                        puts("NO");
                else
                        puts("YES");
        }

        return 0;
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!