본문 바로가기

Competition/codeforces

Educational Codeforces Round 57 (Rated for Div. 2) A. Find Divisible

A. Find Divisible

https://codeforces.com/problemset/problem/1096/A


l과 r이 주어지는데, 그 사이에 배수관계인 수를 찾는 문제이다.

항상 쌍이 존재한다는 것이 보장되므로, 그리디하게 l과 2*l을 출력하면 된다.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <bits/stdc++.h>
using namespace std;
 
int n, a, b;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(NULL); cout.tie(NULL);
    cin >> n;
    while (n--) {
        cin >> a >> b;
        cout << a << ' ' << a * 2 << '\n';
    }
    return 0;
}
cs