D - Annuity Payment Scheme
Time Limit:500MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Description
At the peak of the Global Economic Crisis BerBank offered an unprecedented credit program. The offering was so attractive that Vitaly decided to try it. He took a loan of s burles for m months with the interest rate of p percent. Vitaly has to follow the scheme of annuity payments, meaning that he should make fixed monthly payments — x burles per month. Obviously, at the end of the period he will pay m · x burles to the bank in total. Each of the monthly payments is divided by BerBank into two parts as follows:
- The first part ai is used to pay off the percent p of the current debt. It's clear that ai=s' · p / 100 where s'=s for the first month and equals to the remaining debt for each of the subsequent months.
- The second part bi is used to pay off the current debt. The sum of all bi over the payment period is equal to s, meaning that the borrower needs to pay off the debt completely by decreasing it from s to 0 in m months.
Input
The single line of the input contains three integers s, m and p (1 ≤ s ≤ 10 6, 1 ≤ m ≤ 120, 0 ≤ p ≤ 100).
Output
Output the single value of monthly payment x in burles. An absolute error of up to 10 -5 is allowed.
Sample Input
sample input | sample output |
100 2 50 | 90.00000
|
水题,推个公式出来,注意精度...一遍A
1 /************************************************************************* 2 > File Name: code/2015summer/#5/D.cpp 3 > Author: 111qqz 4 > Email: rkz2013@126.com 5 > Created Time: 2015年07月30日 星期四 13时17分26秒 6 ************************************************************************/ 7 8 #include9 #include 10 #include 11 #include 12 #include 13 #include 14 #include 15 #include