zoukankan      html  css  js  c++  java
  • A. Find Divisible Educational Codeforces Round 57 (Rated for Div. 2)

    A - Find Divisible

    题意:英语翻译题,给你一个l,r区间,要求输出x,y,[x,y]在区间[l,r]中,y是x的倍数,原文中是这样写的

    x divides y  x被y整除

    妈蛋,不用担心,x*2超出r边界,因为题上也说了,一定存在解,原文是这样的

    妈蛋

    题解:左边界l,右边界l*2,妈蛋。

    代码:

    #include <iostream>
    using namespace std;
    #define int long long
    signed main(){
        //cout << "Hello world!" << endl;
        int t;
        cin>>t;
        while(t--){
            int l,r;
            cin>>l>>r;
            cout<<l<<" "<<l*2<<endl;
        }
        return 0;
    }
    

    output

    standard output

    You are given a range of positive integers from ll to rr.

    Find such a pair of integers (x,y)(x,y) that l≤x,y≤rl≤x,y≤r, x≠yx≠y and xx divides yy.

    If there are multiple answers, print any of them.

    You are also asked to answer TT independent queries.

    Input

    The first line contains a single integer TT (1≤T≤10001≤T≤1000) — the number of queries.

    Each of the next TT lines contains two integers ll and rr (1≤l≤r≤9982443531≤l≤r≤998244353) — inclusive borders of the range.

    It is guaranteed that testset only includes queries, which have at least one suitable pair.

    Output

    Print TT lines, each line should contain the answer — two integers xx and yy such that l≤x,y≤rl≤x,y≤r, x≠yx≠y and xx divides yy. The answer in the ii-th line should correspond to the ii-th query from the input.

    If there are multiple answers, print any of them.

    Example

    input

    Copy

    3
    1 10
    3 14
    1 10
    

    output

    Copy

    1 7
    3 9
    5 10
  • 相关阅读:
    P3413 SAC#1
    [BJOI2017]树的难题
    [HNOI/AHOI2018]转盘
    P2664 树上游戏
    [POI2013]BAJ-Bytecomputer
    [ZJOI2010]网络扩容
    数列游戏
    士兵占领
    [ZJOI2016]大森林
    P4755 Beautiful Pair
  • 原文地址:https://www.cnblogs.com/UUUUh/p/10284029.html
Copyright © 2011-2022 走看看