codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1916B.md (1805B)


      1 Source: https://codeforces.com/problemset/problem/1916/B
      2 
      3 B. Two Divisors
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 A certain number $1 \le x \le 10^9$ is chosen. You are given two integers $a$ and $b$, which are the two largest divisors of the number $x$. At the same time, the condition $1 \le a \lt b \lt x$ is satisfied.
     22 
     23 For the given numbers $a$, $b$, you need to find the value of $x$.
     24 
     25 $^{\dagger}$ The number $y$ is a divisor of the number $x$ if there is an integer $k$ such that $x = y \cdot k$.
     26 
     27 Input
     28 
     29 Each test consists of several test cases. The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases. Then follows the description of the test cases.
     30 
     31 The only line of each test cases contains two integers $a$, $b$ ($1 \le a \lt b \le 10^9$).
     32 
     33 It is guaranteed that $a$, $b$ are the two largest divisors for some number $1 \le x \le 10^9$.
     34 
     35 Output
     36 
     37 For each test case, output the number $x$, such that $a$ and $b$ are the two largest divisors of the number $x$.
     38 
     39 If there are several answers, print any of them.
     40 
     41 Example
     42 
     43 Input
     44 
     45 ```
     46 8
     47 
     48 2 3
     49 
     50 1 2
     51 
     52 3 11
     53 
     54 1 5
     55 
     56 5 10
     57 
     58 4 6
     59 
     60 3 9
     61 
     62 250000000 500000000
     63 ```
     64 
     65 Output
     66 
     67 ```
     68 6
     69 4
     70 33
     71 25
     72 20
     73 12
     74 27
     75 1000000000
     76 ```
     77 
     78 Note
     79 
     80 For the first test case, all divisors less than $6$ are equal to $[1, 2, 3]$, among them the two largest will be $2$ and $3$.
     81 
     82 For the third test case, all divisors less than $33$ are equal to $[1, 3, 11]$, among them the two largest will be $3$ and $11$.
     83 
     84 For the fifth test case, all divisors less than $20$ are equal to $[1, 2, 4, 5, 10]$, among them the two largest will be $5$ and $10$.
     85 
     86 For the sixth test case, all divisors less than $12$ are equal to $[1, 2, 3, 4, 6]$, among them the two largest will be $4$ and $6$.