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 ...
随机推荐
- Erlang:[笔记二,构建工具rebar之发布应用]
概述 通过rebar可以发布rebar构建的erlang项目,生成可执行的二进制脚本文件,大大降低了执行应用的复杂度.该笔记Erlang环境为Erlang/OTP 19 ,以下适用于Eralng/OT ...
- 串口调试助手--Qt
串口调试助手----------该程序使用Qt框架,C ++语言编译而成 项目文件介绍: main.cpp 该文件为该程序的入口程序 mainwindow.h 该文件为该程序的主要声明部分 mainw ...
- 无服务架构在IOT的应用场景——使用函数工作流处理DIS数据
在物联网领域,复杂性往往并非在于传感器,真正的复杂性在于各种传感器产生的大量数据,以及对这些数据的处理,所以开发者不得不花费大量的时间去构建和维护后端服务器来处理这样一个庞大的数据流.而在今天这个敏捷 ...
- hdu 6153 思维+扩展kmp
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6153 扩展kmp不理解的看下:http://www.cnblogs.com/z1141000271/p ...
- 笔记 - C#从头开始构建编译器 - 3
视频与PR:https://github.com/terrajobst/minsk/blob/master/docs/episode-03.md 作者是 Immo Landwerth(https:// ...
- 前端关于 superSlide.js 使用,一款基于jquery的前端控件
1引用jQuery.js 和 jquery.SuperSlide.js 2 编写HTML ** 以下是默认的HTMl结构,分别是 ".hd" 里面包含ul, ".bd&q ...
- Asp.Net Core 轻松学系列-4玩转配置文件
目录 前言 另类方式使用 hosting.json 使程序运行于多个端口 结语 前言 在 .NET Core 项目中,配置文件有着举足轻重的地位:与.NetFramework 不同的是,.NE ...
- a2 Bluebottle OS
a2 Bluebottle OS That is a copy of original A2 Repository Also extra ISO image A2_Rev-6498_serial-tr ...
- 括号配对检测 A
括号配对检测 A ...
- 最详细的原生js实现ajax的封装
1. ajax的介绍 1.1 含义 ajax 的全称是Asynchronous JavaScript and XML 简单理解下:ajax就是异步的js和服务端的数据 1.2 组成 异步的js:事件, ...