P9863 [POI 2021/2022 R2] arm
Background
Translated from [POI2021-2022R2 Day0 Warm-up Problem](https://szkopul.edu.pl/problemset/problem/gxeCvLD1xW1t-Y33bbC0n3wZ/statement/).
Description
Initially, you have $1$ item. You need to increase the number of items to $> n$ by performing the following step multiple times.
- Option $1$: Store the current number of items into the database, costing $a$ time.
- Option $2$: Increase the number of items by an amount equal to the number stored in the database, costing $b$ time.
Initially, the database is empty. Find the minimum number of operations.
Input Format
Input one line with three integers $n,a,b\ (1 \leq n \leq 10^{18},1 \leq a,b \leq 10^9)$.
Output Format
Output the minimum number of operations.
Explanation/Hint
Explanation of the sample:
Initially, you have one item.
First, perform one scan, costing $2$ time.
Then print $2$ times, costing $1 \times 2 = 2$ time, and the number increases to $3$.
Continue with another scan, costing $2$ time.
Finally, print $2$ more times, costing $1 \times 2 = 2$ time, and the number becomes $9$.
Subtask distribution:
| Subtask ID | Special Property | Points |
| :-----------: | :-----------: | :-----------: |
| $1$ | $a = b = 1$ | $10$ |
| $2$ | $n \leq 10^3$ | $40$ |
| $3$ | $n \leq 10^5$ | $15$ |
| $4$ | $n \leq 10^9$ | $15$ |
| $5$ | No special constraints | $20$ |
Subtask $0$ is the sample.
Translated by ChatGPT 5