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
随机推荐
- shell输入输出
输出 一.echo命令介绍 1.功能:将内容输出到默认显示设备 2.语法:echo [-ne] [字符串] :输出的字符串以空格隔开,默认会加上换行符 3.选项 -n 不要在最后自动换行 -e 如果字 ...
- LaTeX绘图
http://math.uchicago.edu/~weinan/programs/tex_diagrams/diagrams.html 给大家分享下这个,用鼠标画diagrams,然后可以一键复制l ...
- 如何通过给MM修电脑培养感情
文章来自网络 在修之前,向MM反复声明,这电脑故障是有硬件和软件之分的,如果是硬件故障,例如显卡风扇不转了,显示器连线老化,显示器分辨率超出显示器指标,等等都会导致黑屏啊,这个我不回家用专门的工具是修 ...
- lnmp1.5一键安装包安装lnmpa后,添加站点
lnmp1.5一键安装包安装lnmpa后,添加站点 (1)添加站点 (2)配置apache配置文件 在/usr/local/apache/conf/vhost文件夹下,修改webApp站点配置文件ap ...
- bash数学运算之bc
一.expr 1.1 语法 注意必须有空格 只能精确到整数,无法精确到浮点数 1.2 操作符对照表 使用expr命令时需要加\进行转义,因为部分符号是保留关键字 例1:比较num1跟num2的大小 [ ...
- Codeforces Round #601 (Div. 2) C League of Leesins
把每一次输入的一组数字存下来,然后把每个数字出现的组数存下来 然后找只出现过一次的数字a,那么这个数字a不是开头就是结尾,默认为开头(是哪个都无所谓),然后去找和它出现在同一组的两个数字b和c,而b和 ...
- python | 网络编程(socket、udp、tcp)
一.套接字 socket 1.1 作用:实现不同主机间的进程间通信(不同电脑.手机等设备之间收发数据) 1.2 分类:udp.tcp 1.3 创建 socket import socket socke ...
- 并查集路径减半优化 UnionFind PathHalving (C++)
/* * UnionFind.h * 有两种实现方式,QuickFind和QuickUnion * QuickFind: * 查找O(1) * 合并O(n) * QuickUnion:(建议使用) * ...
- 《深入理解Java虚拟机》读书笔记七
第八章 虚拟机字节码执行引擎 1.运行时栈帧结构 概述: 栈帧是用于支持虚拟机进行方法调用的和方法执行的数据结构,他是虚拟机运行时数据区中的虚拟机栈的栈元素,栈帧存储了方法的局部变量,操作数栈,动态连 ...
- 《深入理解Java虚拟机》读书笔记六
第七章 虚拟机类加载机制 1.类加载的时机 虚拟机的类加载机制: 虚拟机把描述类的数据从class文件中加载到内存,并对数据进行校验.转换解析和初始化,最终形成了可以被虚拟机直接使用的Java类型,这 ...