链接:

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. K8S从入门到放弃系列-(9)kubernetes集群之kubelet部署

    摘要: Kubelet组件运行在Node节点上,维持运行中的Pods以及提供kuberntes运行时环境,主要完成以下使命: 1.监视分配给该Node节点的pods 2.挂载pod所需要的volume ...

  2. Sql Server\ MySql 日期

    ------------------MS Sql Server------------------ declare @ctrBeginTime =null; if(@ctrBeginTime Is N ...

  3. 【转】SpringMVC框架实现后端向前端传数据

    首先还是页面userAdd.jsp.它既是发出请求的页面,也是接收返回结果的页面: <%@ page language="java" import="java.ut ...

  4. Centos7.3安装jenkins

    安装jenkins         下载地址: https://jenkins.io/download/最新版本         将Jenkins上传到tomcat的webapp目录          ...

  5. go 函数闭包

    Go 函数可以是闭包的.闭包是一个函数值,它来自函数体的外部的变量引用. 函数可以对这个引用值进行访问和赋值:换句话说这个函数被“绑定”在这个变量上. 例如,函数 adder 返回一个闭包.每个闭包都 ...

  6. pycharm使用pylint

    # 与能查到的多数博文做法不太一样,自认为这样更简单有效 1. 下载插件 https://plugins.jetbrains.com/plugin/11084-pylint 2. 从磁盘安装插件 注意 ...

  7. hdu 4504 dp问题 转化能力不够 对状态的转移也是不够

    威威猫系列故事——篮球梦 Time Limit: 300/100 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total ...

  8. (一)easyUI之第一个demo

    一.下载 官网下载 : http://www.jeasyui.net/download/   同时并下载官方中文API文档. 解压后的目录结构: 二.第一个demo 1      新建工程并导入包 2 ...

  9. 数据库及MYSQL基础(2)

    数据库及MySQL基础(1) SQL进阶及查询练习 1,单表的查询练习 SELECT * FROM emp WHERE deptno=30; SELECT ename,empno,deptno FRO ...

  10. 在论坛中出现的比较难的sql问题:7(子查询 判断某个字段的值是否连续)

    原文:在论坛中出现的比较难的sql问题:7(子查询 判断某个字段的值是否连续) 最近,在论坛中,遇到了不少比较难的sql问题,虽然自己都能解决,但发现过几天后,就记不起来了,也忘记解决的方法了. 所以 ...