• 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:

    1. If the chosen number aa is even, then the spell will turn it into 3a23a2;
    2. If the chosen number aa is greater than one, then the spell will turn it into a1a−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.

    Input

    The first line contains single integer TT (1T1041≤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 (1x,y1091≤x,y≤109) — the current number and the number that Petya wants to get.

    Output

    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).

    Example
    input
    Copy
    7
    2 3
    1 1
    3 6
    6 8
    1 2
    4 1
    31235 6578234
    
    output
    Copy
    YES
    YES
    NO
    YES
    NO
    YES
    YES
    
    #include<bits/stdc++.h>
    using namespace std ;
    int main() {
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cin >> T;
        while(T--) {
            cin >> X >> Y;
            if (X >= 4) {//当x>=4  所有都能到
                cout << "YES
    ";
            } else if (X == 3 && Y <= 3) {
                cout << "YES
    ";
            } else if (X == 2 && Y <= 3) {
                cout << "YES
    ";
            } else if (X == 1 && Y <= 1) {
                cout << "YES
    ";
            } else cout << "NO
    ";
        }
        return 0;
    }
  • 相关阅读:
    Spring Cloud学习笔记【二】Eureka 服务提供者/服务消费者(ribbon)
    Spring Cloud学习笔记【一】Eureka服务注册与发现
    Springboot分布式限流实践
    Springboot分布式锁实践(redis)
    Springboot2本地锁实践
    Springboot集成mybatis通用Mapper与分页插件PageHelper
    Springboot多数据源配置
    redis主从集群搭建
    assert的基本用法
    spring中BeanPostProcessor笔记
  • 原文地址:https://www.cnblogs.com/QingyuYYYYY/p/11863744.html
Copyright © 2020-2023  润新知