Find Divisible
Hazrat Ali
Find such a pair of integers (x,y) that l≤x,y≤r, x≠y and x divides y.
If there are multiple answers, print any of them.
You are also asked to answer T independent queries.
The first line contains a single integer T (1≤T≤1000) — the number of queries.
Each of the next T lines contains two integers l and r (1≤l≤r≤998244353) — inclusive borders of the range.
It is guaranteed that testset only includes queries, which have at least one suitable pair.
Print T lines, each line should contain the answer — two integers x and y such that l≤x,y≤r, x≠y and x divides y. The answer in the i-th line should correspond to the i-th query from the input.
If there are multiple answers, print any of them.
3 1 10 3 14 1 10
1 7 3 9 5 10
Solution
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int l, r;
cin >> l >> r;
cout << l << " " << 2 * l << endl;
}
return 0;
}