4/1/24, 8:57 AM Problem - 1485A - Codeforces
|
riteshnub | Logout
You have +385! Wow!
HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP
PROBLEMS SUBMIT STATUS STANDINGS CUSTOM TEST
00:00:04
Codeforces Round 701 (Div. 2)
Finished
A. Add and Divide
time limit per test: 1 second Practice
memory limit per test: 256 megabytes
input: standard input
output: standard output
→ Virtual participation
You have two positive integers a and b.
Virtual contest is a way to take part in past
contest, as close as possible to participation
You can perform two kinds of operations: on time. It is supported only ICPC mode for
virtual contests. If you've seen these
a = ⌊
a
⌋ (replace a with the integer part of the division between a and b) problems, a virtual contest is not for you -
b solve these problems in the archive. If you
b = b + 1 (increase b by 1) just want to solve some problem from a
contest, a virtual contest is not for you -
solve this problem in the archive. Never use
Find the minimum number of operations required to make a = 0 . someone else's code, read the tutorials or
communicate with other person during a
Input virtual contest.
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
).
Output → Clone Contest to Mashup
For each test case, print a single integer: the minimum number of operations required to make
You can clone this contest to a mashup.
a = 0.
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 .
Codeforces (c) Copyright 2010-2024 Mike Mirzayanov
The only programming contests Web 2.0 platform
Server time: Apr/01/2024 08:57:54UTC+5.5 (i1).
Desktop version, switch to mobile version.
Privacy Policy
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