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
随机推荐
- 强烈推荐一款强大的公式编辑器软件AxMath
Axmath教程请移步:https://www.cnblogs.com/coco56/p/11759578.html
- java中类的构造方法出错点
大家请看下面的这个代码 package ppt_test; public class test1 { public static void main(String args[]) { Foo obj1 ...
- LED Keychain-Ideal For Mass Promotions
Looking for something memorable to remind people of your business or nonprofit? Consider custom LED ...
- Pytest学习9-常用插件
pytest-django:为django应用程序编写测试. pytest-twisted:为twisted应用程序编写测试,启动反应堆并处理测试函数的延迟. pytest-cov:覆盖率报告,与分布 ...
- window.resizeTo
概述 动态调整窗口的大小. 语法 window.resizeTo(aWidth, aHeight) 参数 aWidth 是一个整数,表示新的 outerWidth(单位:像素)(包括滚动条.窗口边框等 ...
- 菜鸟教程 Missing parentheses in call to 'print'
个人博客 地址:http://www.wenhaofan.com/article/20180618180327 >>> print "hello" SyntaxE ...
- git本地仓库远程仓库地址更改
git remote rm origingit remote add origin git@52.82.8.87:iot3.0-service/test.gitgit push -u origin - ...
- rest_framework:版本控制
一.作用: 用于版本的控制,区分不同的功能,对于一些新增功能的添加更新就会在新的版本中体现,有点类似于,新版本就是软件发布的新版本,和老版本相比新增或者修改了一些功能 二.内置的版本控制类: from ...
- CF399B Red and Blue Balls
题目 CF399B 洛谷RemoteJudge 思路 很容易发现,栈中靠上的蓝色球的出栈,对它下方的蓝色球没有影响. 举个例子: 第一步中靠上的蓝色球在第三步出栈了,这一过程对它下面的蓝色球(即第一步 ...
- Mahmoud and Ehab and the message
Mahmoud wants to send a message to his friend Ehab. Their language consists of n words numbered from ...