Problem - 1485A - Codeforces
Problem - 1485A - Codeforces
|
riteshnub | Logout
You have +385! Wow!
HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP
00:00:04
The first line contains a single integer t (1 ≤ t ≤ 100 ) — the number of test cases. Start virtual contest
The only line of the description of each test case contains two integers a, b (1 ≤ a, b ≤ 10
9
).
Clone Contest
Example
input Copy
→ Submit?
6
9 2
1337 1 Language: GNU G++17 7.3.0
1 1
50000000 4 Choose
Choose File No file chosen
991026972 997 file:
1234 5678
Submit
output Copy
4
9
2
→ Problem tags
12
3 brute force greedy math
1 number theory *1000
No tag edit access
Note
In the first test case, one of the optimal solutions is:
→ Contest materials
1. Divide a by b. After this operation a = 4 and b = 2 .
2. Divide a by b. After this operation a = 2 and b = 2 . Announcement (en)
3. Increase b. After this operation a = 2 and b = 3 .
Tutorial (en)
4. Divide a by b. After this operation a = 0 and b = 3 .
Supported by
https://codeforces.com/problemset/problem/1485/A 1/2
4/1/24, 8:57 AM Problem - 1485A - Codeforces
https://codeforces.com/problemset/problem/1485/A 2/2