Educational Codeforces Round 76 (Rated for Div. 2) B. Magic Stick
Recently Petya walked in the forest and found a magic stick.
Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer:
- If the chosen number aa is even, then the spell will turn it into 3a23a2;
- If the chosen number aa is greater than one, then the spell will turn it into a−1a−1.
Note that if the number is even and greater than one, then Petya can choose which spell to apply.
Petya now has only one number xx. He wants to know if his favorite number yy can be obtained from xx using the spells he knows. The spells can be used any number of times in any order. It is not required to use spells, Petya can leave xx as it is.
The first line contains single integer TT (1≤T≤1041≤T≤104) — the number of test cases. Each test case consists of two lines.
The first line of each test case contains two integers xx and yy (1≤x,y≤1091≤x,y≤109) — the current number and the number that Petya wants to get.
For the ii-th test case print the answer on it — YES if Petya can get the number yy from the number xx using known spells, and NOotherwise.
You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
7
2 3
1 1
3 6
6 8
1 2
4 1
31235 6578234
YES
YES
NO
YES
NO
YES
YES
#include<bits/stdc++.h>
using namespace std ;
int main() {
ios_base::sync_with_stdio(false);
cin.tie();
cin >> T;
while(T--) {
cin >> X >> Y;
if (X >= ) {//当x>=4 所有都能到
cout << "YES\n";
} else if (X == && Y <= ) {
cout << "YES\n";
} else if (X == && Y <= ) {
cout << "YES\n";
} else if (X == && Y <= ) {
cout << "YES\n";
} else cout << "NO\n";
}
return ;
}
Educational Codeforces Round 76 (Rated for Div. 2) B. Magic Stick的更多相关文章
- Educational Codeforces Round 76 (Rated for Div. 2) B. Magic Stick 水题
B. Magic Stick Recently Petya walked in the forest and found a magic stick. Since Petya really likes ...
- Educational Codeforces Round 76 (Rated for Div. 2) E. The Contest
Educational Codeforces Round 76 (Rated for Div. 2) E. The Contest(dp+线段树) 题目链接 题意: 给定3个人互不相同的多个数字,可以 ...
- 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 ...
- Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)
Problem Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...
- Educational Codeforces Round 76 (Rated for Div. 2)E(dp||贪心||题解写法)
题:https://codeforces.com/contest/1257/problem/E 题意:给定3个数组,可行操作:每个数都可以跳到另外俩个数组中去,实行多步操作后使三个数组拼接起来形成升序 ...
- Educational Codeforces Round 76 (Rated for Div. 2)
传送门 A. Two Rival Students 签到. Code /* * Author: heyuhhh * Created Time: 2019/11/13 22:37:26 */ #incl ...
- Educational Codeforces Round 76 (Rated for Div. 2) E. The Contest dp
E. The Contest A team of three programmers is going to play a contest. The contest consists of
- Educational Codeforces Round 76 (Rated for Div. 2) D. Yet Another Monster Killing Problem 贪心
D. Yet Another Monster Killing Problem You play a computer game. In this game, you lead a party of
- Educational Codeforces Round 76 (Rated for Div. 2) C. Dominated Subarray 水题
C. Dominated Subarray Let's call an array
随机推荐
- 0004 工程配置settings.py
两个目录的区别: 工程目录是指包含manage.py文件的目录 配置目录是批包含settings.py文件的目录 在配置目录中找到并打工settings.py文件,做以下配置: 01 DEBUG DE ...
- MySQL的联表查询
MySQL的联表查询 首选:分析查询的字段来自哪些表 进而:确定交集 然后:确定判断的条件 比如:从student表 和 result表 查学号.考试名称.学时.考试日期.考试成绩 表1: 学号 考试 ...
- 为data中的某一个对象添加一个属性不起作用——this.$set的正确使用
this.$set(obj, key, value) 我们在项目开发的过程中,经常会遇到这种情况:为data中的某一个对象添加一个属性 <template> <div class=& ...
- [HAOI2011] Problem b - 莫比乌斯反演
复习一下莫比乌斯反演 首先很显然用一下容斥把它转化成求 \(ans=\sum_{i=1}^a \sum_{j=1}^b [{gcd(i,j)=d}]\) 我们可以定义 f(d) 和 F(d) 如下: ...
- Appium+python自动化-Android夜神模拟器
前言 Android SDK虽然也自带了模拟器,但是那速度会让你怀疑人生,并且不稳定经常卡死异常.夜神模拟器可以说是android模拟器里面的一个神器. 环境安装 1.官网下载地址:https://w ...
- Java生鲜电商平台-生鲜电商订单结算系统的深入解析与反思总结
Java生鲜电商平台-生鲜电商订单结算系统的深入解析与反思总结 说明:最近疫情影响,生鲜电商这个行业被彻底的激活了,全中国人民都知道用小程序或者APP可以进行买菜了,但是可惜的是,我的生鲜电商在去年经 ...
- jQuery图片剪裁插件Cropper.js的使用
插件下载地址及文档说明 1.引入必要的js和css核心文件 <link rel="stylesheet" href="../css/cropper.css" ...
- 动态规划 ---- 最长公共子序列(Longest Common Subsequence, LCS)
分析: 完整代码: // 最长公共子序列 #include <stdio.h> #include <algorithm> using namespace std; ; char ...
- EF的预先加载--Eager Loading
预先加载 在对一种类型的实体进行查询时,将相关的实体作为查询的一部分一起加载.预先加载可以使用Include()方法实现. 在此需要说明的是:EF中有两种表关联的方法,一种是Join()方法,一种是I ...
- 安装破解pycharm2018版
1.安装2018版pycharm: 2.把破解补丁放在一个地方(目录无中文,无空格): 3.在 Pycharm安装目录的\bin目录下找到 pycharm.exe.vmoptions 和 pychar ...