Installment Purchase

Xem dạng PDF

Gửi bài giải

Điểm: 1,00 (OI)
Giới hạn thời gian: 1.0s
Giới hạn bộ nhớ: 256M
Input: stdin
Output: stdout

Nguồn bài:
Hà Minh Ngọc
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch

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 \times (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 ~(1 ≤ V ≤ 10^9, 1 ≤ T ≤ 60)~.
  • The second line includes two real numbers ~N~ and ~M~ ~(1 ≤ N, M ≤ 10^9)~

Output

  • Print interest rounded to ~3~ decimal places.

Sample Input

20000000 8                                         
5000000 2000000

Sample Output

0.015

Bình luận

Hãy đọc nội quy trước khi bình luận.


Không có bình luận tại thời điểm này.