#CCBOTPBA0000052. Tháng đạt mục tiêu tăng trưởng (Month to Reach a Growth Target)
Tháng đạt mục tiêu tăng trưởng (Month to Reach a Growth Target)
Month to Reach a Growth Target
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
An initial amount of capital is . At the end of each month, it grows by percent of its value at the beginning of that month; each increase is reinvested before the next month. Find the smallest number of months from through such that the capital after months is at least the target . If the initial amount already meets the target, the answer is . If it is still below the target after months, print .
Input
One line contains three real numbers , , and : the initial capital, the target, and the monthly percentage growth rate, in that order.
Output
Print one integer: the minimum with and capital after months at least ; print if no such exists.
Subtasks
- Subtask 1 (20%): .
- Subtask 2 (30%): .
- Subtask 3 (50%): .
Examples
Example 1
Input:
100 121 10
Output:
2
Explanation: At month , the capital is . After month it is . After month it is , meeting the target for the first time. Print .
Example 2
Input:
150 100 5
Output:
0
Explanation: The initial amount is already at least , so no month is needed.
Example 3
Input:
0 1 100
Output:
-1
Explanation: The capital remains after every month, so it never reaches within months.