Savings Account
来源:互联网 发布:大学生电脑软件推荐 编辑:程序博客网 时间:2024/06/05 08:45
Suppose you open a savings account with a certain initial balance. You will not make any withdrawals or further deposits for a number of years. The bank will compound your balance (add the annual interest) once a year, on the anniversary of the opening of the account. Your goal is to achieve a certain target amount in your savings account. In how may years will the target amount be achieved?
200.00 6.5 300500 4 1000.00
718
给出本金,年利率(百分之),目标存款
存款 = 本金 * (1+年率)^ i (i 为存款年限)
代码:
#include<stdio.h>#include<math.h>#include<string.h>using namespace std;double a,p,b;int F(){int i=0;double sum=a;while(1){if(sum>=b) break;sum=a*pow(1+p*0.01,i);//printf("%.3f\n",sum);i++;}return i;}int main(){while(scanf("%lf%lf%lf",&a,&p,&b)!=EOF){printf("%d\n",F()-1);}return 0;}
阅读全文
0 0
- Savings Account
- HOJ 2597 Savings Account
- Hdu 2398 - Savings Account
- hdu2398 Savings Account - 数学
- 实体类-银行账户余额推算表(Savings Account Class)
- account
- Account
- Account
- account
- account
- Daylight Savings Time (DST)
- CDOJ 1114 Cent Savings
- Cent Savings (DP)
- UVALive6952 Cent Savings DP
- Cent Savings UVALive
- TimeZone里的daylight savings
- TimeZone里的daylight savings
- HNU Cent Savings (DP)
- OpenCV中VideoWriter输出视频文件为空或6KB解决方法(java)
- scala slick基本使用教程
- TOMCAT关闭自动重启方法总结
- composer安装thinkphp5
- MySQL| MySQL语句的执行顺序
- Savings Account
- PHP使用ip2long返回负数
- zookeeper一台机器启动三台zookeeper同时类似操作kafka
- Spring Boot 集成Swagger
- java 多态
- (转载)Python数据分析之pandas学习
- Apache.POI.HSSF获取单元格数据为String类型(参考源码)新
- ConcurrentHashMap总结
- Java基础之数据类型(一)与传值传引用分析