I Hate Ready to Program P8 - Imploding IDE

View as PDF

Submit solution

Points: 7
Time limit: 1.5s
Memory limit: 128M

Author:
Problem type

It seems that recently Ready to Program has been degrading! Currently, RtP can handle N inputs before crashing. However, for each day that passes, the number of inputs decreases by P\% rounded down. Thankfully, uninstalling and reinstalling RtP increases the number of inputs by K each time. You know that a huge assignment involving file input and output is arriving soon, so you would like for RtP to be able to handle at least I inputs after D days. Since you don't want to waste the entire period spam reinstalling RtP, you would like to find out the minimum number of times you have to reinstall RtP each day such that after D days, RtP can handle at least I inputs.

Constraints

1 \leq N,I \leq 10^{12}

0 \leq P \leq 100

1 \leq D \leq 10^6

1 \leq K \leq 10^3

Input Specifications

The first and only line will contain 5 space-separated integers, N,P,K,I,D. Note that P is a percentage.

Output Specifications

Output the minimum number of times you have to reinstall RtP each day such that after D days, RtP can handle at least I inputs.

Sample Input

200 50 50 100 3

Sample Output

1

Sample Case Explanation

After the first day, RtP can handle 200\times(100-50)\%+1\times50 = 150 lines.

After the second day, RtP can handle 150\times(100-50)\%+1\times50 = 125 lines.

After the third day, RtP can handle \lfloor125\times(100-50)\%\rfloor+1\times50 = 112 lines.

Credits to the question "Tree Sustainability" for inspiration.


Comments

There are no comments at the moment.