1096A Find Divisible

版权声明:大家一起学习,欢迎转载,转载请注明出处。若有问题,欢迎纠正! https://blog.csdn.net/memory_qianxiao/article/details/85336498

题意:隔了t组数据,每组两个数l,r,让你输出x,y,必须在l,r区间中。题意说了至少有一组满足。

题解:直接输出l,2*r。

A. Find Divisible

time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

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

c++:

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,x,y;
    cin>>t;
    while(t--)
    {
        cin>>x>>y;
        cout<<x<<" "<<2*x<<endl;
    }
    return 0;
}

python:

for i in range(int(input())):
          l,r=map(int,input().split())
          print(l,2*l)

猜你喜欢

转载自blog.csdn.net/memory_qianxiao/article/details/85336498