Submit | All submissions | Best solutions | Back to list |
EIPURCHASE1 - Installment Purchase |
Huy needs to buy a laptop in the form of installment payment. The employee of XXX company told Huy that he only needs to pay N VND in advance, and M VND per month for the next T months
For example, a laptop costs 20 million, Huy can pay 5 million in advance, and pay 2 million every month in the next 8 months. The total amount Huy has to pay is 21 million. The store employee said that such interest rate was only 5% for 8 months.
Huy knows that if at the n-th month, the remaining debt is X, then at (n + 1)-th month the debt will be X * (1 + r) - G. Where r is the monthly interest rate, and G is the money monthly payment.
Help Huy write a program to calculate the real interest rate for this purchase.
Input
The first line contains the number V, the actual value of the item, and T is the number of months in installment.
The second line includes N and M.
(1 ≤ V, N, M ≤ 109, 1 ≤ T ≤ 60)
Output
Print interest rounded to 3 decimal places.
Sample
Input Output
20000000 8 0.015
5000000 2000000
Added by: | Ha Minh Ngoc |
Date: | 2017-11-19 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: GOSU |