Processing math: 5%

Thứ Năm, 3 tháng 1, 2019

Codeforces Round 57- Bài 1

Bài 1: You are given a range of positive integers from l to r
Find such a pair of integers (x,y) that l\le x,y\le r,x\ne y and x divides y
If there are multiple answers, print any of them.
You are also asked to answer T independent queries
Input
The first line contains a single integer T(1\le T\le 1000)- the number of queries. 
Each of the next T lines contains two integers l and r(1\le l\le r\le 998244353) - inclusive borders of the range.
It is guaranteed that testset only includes queries, which have at least one suitable pair.
Output
Print T lines, each line should contain the answer- two integer x and y such that 1\le x,y\le r,x\ne y and x divides y. The answer in the i-th lines should correspond to the i-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
Solution:
#include<bits/stdc++.h>
using namespace std;
int main(){
    int t,l,r;
   cin>>t;
   while(t--){
    cin>>l>>r;
    cout<<l<<" "<<2*l<<'\n';
   }
   return 0;
}

Không có nhận xét nào:

Đăng nhận xét

Bài G - Educatioal Round 62

Đề bài: Bạn được cho 1 đồ thị vô hướng đặc biệt. Nó bao gồm 2n đỉnh được đánh số từ 1 đến 2n. Dưới đây là một số đặc tính của đồ thị: + ...