博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SGU 456 Annuity Payment Scheme
阅读量:4337 次
发布时间:2019-06-07

本文共 2805 字,大约阅读时间需要 9 分钟。

D - Annuity Payment Scheme
Time Limit:500MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u
Submit     

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.
BerBank uses calculations with floating-point numbers, and the value of 
x is uniquely determined by 
s
m and 
p
For example, if 
s=100, 
m=2, 
p=50 then 
x=90. For the first month 
a
1 = 
s' · 
p / 100 = 
s · 
p / 100 = 50 and 
b
1 = 90 - 50 = 40. For the second month 
a
2 = (100-40) · 50 / 100 = 30, so 
b
2 = 90 - 30 = 60 and the debt is paid off completely. 
Your task is to help Vitaly and write a program that computes 
x given the values of 
s
m and 
p.

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 #include
9 #include
10 #include
11 #include
12 #include
13 #include
14 #include
15 #include
16 #include
17 #include
18 #include
19 #include
20 #define y0 abc111qqz21 #define y1 hust111qqz22 #define yn hez111qqz23 #define j1 cute111qqz24 #define tm crazy111qqz25 #define lr dying111qqz26 using namespace std;27 #define REP(i, n) for (int i=0;i
>s>>m>>p;47 double sum = 0;48 double per = p*1.0/100+1;49 for ( int i = 1 ; i <= m; i++ )50 {51 sum=sum+1.0/cal(per,i);52 // cout<<"sum:"<
<

 

转载于:https://www.cnblogs.com/111qqz/p/4690432.html

你可能感兴趣的文章
安卓开发笔记——关于文件断点续传
查看>>
Logistic回归
查看>>
ASP.NET多个提交按钮页面,回车Enter执行指定按钮的事件(转)
查看>>
Dialog+NumberPicker
查看>>
12306 查票接口
查看>>
Django 路由控制
查看>>
ARM Linux入门与实践(内附光盘1张)
查看>>
【模板】AC自动机(简单版)
查看>>
WINCE BSP包只读属性导致编译出错
查看>>
windows文件传输方法
查看>>
如何推天干地支获取自己生辰八字
查看>>
洛谷3354(IOI2005)河流——“承诺”
查看>>
bzoj 2946 [Poi2000]公共串——后缀自动机
查看>>
设计模式 - Singleton
查看>>
Graph Valid Tree -- LeetCode
查看>>
C#通过Ado.net对连接数据库并进行添加删除等常规操作的代码
查看>>
康拓展开
查看>>
swap交换2变量
查看>>
洛谷P2495 [SDOI2011]消耗战(虚树)
查看>>
HP服务器安装CentOS7 x64无法识别阵列卡
查看>>