CF1916B.Two Divisors

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

A certain number 1≤x≤1091 \le x \le 10^9 is chosen. You are given two integers aa and bb, which are the two largest divisors of the number xx. At the same time, the condition 1≤a<b<x1 \le a \lt b \lt x is satisfied.

For the given numbers aa, bb, you need to find the value of xx.

†^{\dagger} The number yy is a divisor of the number xx if there is an integer kk such that x=y⋅kx = y \cdot k.

某个数 1≤x≤1091 \le x \le 10^9 被选定。给你两个整数 aa 和 bb,它们是数 xx 的两个最大真因数(即除数)。同时满足条件 1≤a<b<x1 \le a \lt b \lt x。

对于给定的数 aa、bb,你需要求出 xx 的值。

†^{\dagger} 若存在整数 kk 使得 x=y⋅kx = y \cdot k,则称数 yy 是数 xx 的一个因数(即除数)。

输入格式

Each test consists of several test cases. The first line contains a single integer tt (1≤t≤1041 \le t \le 10^4) — the number of test cases. Then follows the description of the test cases.

The only line of each test cases contains two integers aa, bb (1≤a<b≤1091 \le a \lt b \le 10^9).

It is guaranteed that aa, bb are the two largest divisors for some number 1≤x≤1091 \le x \le 10^9.

每个测试包含若干测试用例。第一行包含一个整数 tt(1≤t≤1041 \le t \le 10^4),表示测试用例的数量。随后是各测试用例的描述。

每个测试用例仅有一行,包含两个整数 aa、bb(1≤a<b≤1091 \le a \lt b \le 10^9)。

保证存在某个满足 1≤x≤1091 \le x \le 10^9 的整数 xx,使得 aa 和 bb 恰好是 xx 的两个最大的正因数。

输出格式

For each test case, output the number xx, such that aa and bb are the two largest divisors of the number xx.

If there are several answers, print any of them.

对于每个测试用例,输出一个数 xx,使得 aa 和 bb 是该数 xx 的两个最大因数。

若存在多个答案,输出任意一个即可。

输入输出样例

  • 输入#1

    8
    2 3
    1 2
    3 11
    1 5
    5 10
    4 6
    3 9
    250000000 500000000

    输出#1

    6
    4
    33
    25
    20
    12
    27
    1000000000

说明/提示

For the first test case, all divisors less than 66 are equal to [1,2,3][1, 2, 3], among them the two largest will be 22 and 33.

For the third test case, all divisors less than 3333 are equal to [1,3,11][1, 3, 11], among them the two largest will be 33 and 1111.

For the fifth test case, all divisors less than 2020 are equal to [1,2,4,5,10][1, 2, 4, 5, 10], among them the two largest will be 55 and 1010.

For the sixth test case, all divisors less than 1212 are equal to [1,2,3,4,6][1, 2, 3, 4, 6], among them the two largest will be 44 and 66.

对于第一个测试用例,所有小于 66 的约数为 [1,2,3][1, 2, 3],其中最大的两个是 22 和 33。

对于第三个测试用例,所有小于 3333 的约数为 [1,3,11][1, 3, 11],其中最大的两个是 33 和 1111。

对于第五个测试用例,所有小于 2020 的约数为 [1,2,4,5,10][1, 2, 4, 5, 10],其中最大的两个是 55 和 1010。

对于第六个测试用例,所有小于 1212 的约数为 [1,2,3,4,6][1, 2, 3, 4, 6],其中最大的两个是 44 和 66。

输入解题思路,AI测评打分。不知道怎么写?

首页