链接:

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;
}

Educational Codeforces Round 74 (Rated for Div. 2) A. Prime Subtraction的更多相关文章

  1. Educational Codeforces Round 74 (Rated for Div. 2) D. AB-string

    链接: https://codeforces.com/contest/1238/problem/D 题意: The string t1t2-tk is good if each letter of t ...

  2. Educational Codeforces Round 74 (Rated for Div. 2) C. Standard Free2play

    链接: https://codeforces.com/contest/1238/problem/C 题意: You are playing a game where your character sh ...

  3. Educational Codeforces Round 74 (Rated for Div. 2) B. Kill 'Em All

    链接: https://codeforces.com/contest/1238/problem/B 题意: Ivan plays an old action game called Heretic. ...

  4. Educational Codeforces Round 74 (Rated for Div. 2)

    传送门 A. Prime Subtraction 判断一下是否相差为\(1\)即可. B. Kill 'Em All 随便搞搞. C. Standard Free2play 题意: 现在有一个高度为\ ...

  5. Educational Codeforces Round 74 (Rated for Div. 2)【A,B,C【贪心】,D【正难则反的思想】】

    A. Prime Subtractiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inpu ...

  6. Educational Codeforces Round 74 (Rated for Div. 2)补题

    慢慢来. 题目册 题目 A B C D E F G 状态 √ √ √ √ × ∅ ∅ //√,×,∅ 想法 A. Prime Subtraction res tp A 题意:给定\(x,y(x> ...

  7. Educational Codeforces Round 74 (Rated for Div. 2)E(状压DP,降低一个m复杂度做法含有集合思维)

    #define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h>using namespace std;char s[100005];int pos[ ...

  8. Educational Codeforces Round 39 (Rated for Div. 2) B. Weird Subtraction Process[数论/欧几里得算法]

    https://zh.wikipedia.org/wiki/%E8%BC%BE%E8%BD%89%E7%9B%B8%E9%99%A4%E6%B3%95 取模也是一样的,就当多减几次. 在欧几里得最初的 ...

  9. Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...

随机推荐

  1. Netty源码剖析-关闭服务

    参考文献:极客时间傅健老师的<Netty源码剖析与实战>Talk is cheap.show me the code! ----主线:  ----源码: 先在服务端加个断点和修改下代码:如 ...

  2. Word 查找替换高级玩法系列之 -- 将换行符替换成回车符

    我们从网上Copy过来的很多Word文档,里面使用的都是换行符,也就是我们常说的软回车,它显示为一个向下的箭头.这些符号不仅碍眼,而且会影响我们后期的排版,尤其是对段落的排版,因为Word里面的段落只 ...

  3. WUSTOJ 1274: 喂,这里是帅帅的LCM(Java)

    1274: 喂,这里是帅帅的LCM 题目   在一组数中,找出个数为奇数的数.更多内容点击标题. 分析   其实这种题并不难,做过一次之后,绝对不会错第二次.通过读题可以发现,我们要找的那个数在这一堆 ...

  4. xv6解析-- 多处理器操作

    xv6可以运行多cpu的计算机上,这个os使用mycpu函数来标识初当前的cpu,使用struct cpu结构体来记录当前的CPU状态.使用cpus这些状态存放于cpus数组中,使用ncpu来标志cp ...

  5. RMAN执行crosscheck archive报错ORA-19633问题处理

    一.问题现象 RMAN connect target /; run { crosscheck archivelog all; } ORA-: control file record is out of ...

  6. (十一)Activitivi5之流程控制网关:连线

    一.案例 1.1 需求 我们希望如果是重要情况才需要班主任审批,否则班长审批就行. 1.2 案例 当流程走到“班长审批”任务节点的时候,如果是一般情况,则如下: /** * 完成任务 */ @Test ...

  7. log4j2.xml配置,导致启动报错

    项目中遇到问题,当使用tomcat启动时,没问题:当使用内置tomcat启动时却报错,找不到日志路径. 变量位置: <properties> <property name=" ...

  8. js数组破坏性和非破坏性方法

    数组原型方法:破坏性.会改变数组. shift().unshift().pop().push().splice();resver(),sort().在对数字排序的时候不能用原来的方法了,那样会导致值溢 ...

  9. [Vuex系列] - Module的用法(终篇)

    于使用单一状态树,应用的所有状态会集中到一个比较大的对象.当应用变得非常复杂时,store 对象就有可能变得相当臃肿.为了解决以上问题,Vuex 允许我们将 store 分割成模块(module).每 ...

  10. windows使用msi包安装mysql8.0.12

    1.前言 利用windows提供的二进制分发包(msi)安装是非常简单的,只要根据提示安装就可以了,和安装普通软件没有什么区别.但是如果想在安装的时候就把规划的配置好,是需要看懂每个步骤到底做什么用, ...