Educational Codeforces Round 74 (Rated for Div. 2) A. Prime Subtraction
链接:
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的更多相关文章
- 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 ...
- 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 ...
- 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. ...
- Educational Codeforces Round 74 (Rated for Div. 2)
传送门 A. Prime Subtraction 判断一下是否相差为\(1\)即可. B. Kill 'Em All 随便搞搞. C. Standard Free2play 题意: 现在有一个高度为\ ...
- Educational Codeforces Round 74 (Rated for Div. 2)【A,B,C【贪心】,D【正难则反的思想】】
A. Prime Subtractiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inpu ...
- Educational Codeforces Round 74 (Rated for Div. 2)补题
慢慢来. 题目册 题目 A B C D E F G 状态 √ √ √ √ × ∅ ∅ //√,×,∅ 想法 A. Prime Subtraction res tp A 题意:给定\(x,y(x> ...
- 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[ ...
- 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 取模也是一样的,就当多减几次. 在欧几里得最初的 ...
- 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 ...
随机推荐
- Oracle之配置节点间相互信任机制测试
更改一下,之前的都不对,现在来一版简单有效的ssh互信配置 例如我的是在配置rac,在grid用户下配置互信:建立好相应的文件 mkdir .ssh chmod -R 700 .ssh/ 使用ssh- ...
- Neo4j常用的查询
一.添加操作 1. 添加节点: create (x:学生{studentId:'1001',age:20} 2. 添加关系: 对现有的节点添加关系 match (x:学生{studentId:1001 ...
- es查询优化思路
尽可能的利用内存 将尽可能的索引留在内存,即留更多的堆外内存给es 不查询的字段尽量不要往es插入,节省索引的空间大小(es + hbase) 数据预热 冷热数据分离 文档字段设计 根据查询场景设计字 ...
- JSON、GSON
文章目录 什么是JSON 特点 JSON的数据结构 -- Object JSON的数据结构 -- Array JSON的数据结构 -- 基本类型 构建 JSON 数据 解析 JSON 数据 GSON ...
- asp.net core-5.控制台读取json文件
1,创建控制台应用程序,应用using Microsoft.Extensions.Configuration; 2,新建一个app.json文件 然后修改app.json的属性 3,生成项目,可以看到 ...
- MD5加密处理
无论传送过程和存储方式,都是以明文的方式,很不安全!一旦泄漏,将会造成很大的损失! 插件名称jQuery.MD5.js: /** * jQuery MD5 hash algorithm functio ...
- IntelliJ Idea清除Open Recent里面的项目列表
2种方法清除IntelliJ Idea 中 Open Recent里面的项目列表 第一种方法: 如下图: Open Recent -> Manage Projects Recent Projec ...
- win10 右键新建卡顿
前段时间不知道自己搞啥了,右键变得很慢,找了一些常规的解决方案,什么清除注册表等等的,对我来说,没好用. 然后将就继续使用,然后觉得是office的问题,卸载,重装2010的,发现还是一样卡... 继 ...
- (十)Activitivi5之启动流程/完成任务的时候设置流程变量
一.启动流程的时候设置流程变量 1.1 案例 /** * 启动流程实例 */ @Test public void start() { Student student=new Student(); st ...
- 搭建SSM环境(淘淘商城)
本文用到的资料: 链接:https://pan.baidu.com/s/1Pk_aI_PRbqRFP9i3o9Xodg 提取码:o4o4 1.1. 数据库 1.1.1. 使用navicat创建数据库连 ...