Savings Account

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 779    Accepted Submission(s): 545

Problem Description
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?
 
Input
The input file will contain data for one or more test cases, one test case per line. Each line will contain three numbers: the initial balance, the annual interest rate (as a percentage of the balance), and the target amount, separated by blank spaces. These will be positive numbers; they may or may not contain a decimal point. The target amount will be greater than the initial balance. The input is terminated by end-of-file
 
Output
For each line of input, your program will produce exactly one line of output: This line will contain one positive integer value: the number of years required to achieve the target amount.
 
Sample Input
200.00 6.5 300 500 4 1000.00
 
Sample Output
7 18
 
Author
2006Rocky Mountain Warmup
 
Source
水体:
代码:
 #include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
double a,r,tot;
int cnt=;
while(scanf("%lf%lf%lf",&a,&r,&tot)!=EOF)
{
r/=;
while(tot-a>1.0e-8)
{
cnt++;
a*=(r+);
}
printf("%d\n",cnt);
cnt=;
}
return ;
}

HDUOJ------2398Savings Account的更多相关文章

  1. 以bank account 数据为例,认识elasticsearch query 和 filter

    Elasticsearch 查询语言(Query DSL)认识(一) 一.基本认识 查询子句的行为取决于 query context filter context 也就是执行的是查询(query)还是 ...

  2. 在SharePoint 2010中,如何找回丢失的服务账号(Service Account)密码

    背景信息: 通常在SharePoint环境中我们会使用很多的服务账号来运行各种不同的服务,尤其在企业环境中,由于权限管理条例严格,这些服务账号更是只能多不能少.面对如此多的服务账号,各个企业都会有自己 ...

  3. SQL Server 2012 Managed Service Account

    原创地址:http://www.cnblogs.com/jfzhu/p/4007472.html 转载请注明出处 (一)Windows服务使用的登陆帐号 Windows服务只有登录到某一帐户的情况下才 ...

  4. Your account already has a valid iOS Distribution certificate!

    iOS 发布提交出现:Your account already has a valid iOS Distribution certificate!问题解决 转载的链接   http://www.jia ...

  5. scott/tiger登录时提醒ora-28000 the account is locked

    scott/tiger登录时提示ora-28000 the account is locked在plsql developer中要是以scott/tiger登录时提示ora-28000 the acc ...

  6. hduoj 1455 && uva 243 E - Sticks

    http://acm.hdu.edu.cn/showproblem.php?pid=1455 http://uva.onlinejudge.org/index.php?option=com_onlin ...

  7. Xcode真机调试出现The account '***' has no team with ID '***'的解决方案

    前段时间,想用真机调试的时候出现 The account '***' has no team with ID '***'的问题, 以前页真机调试过,没有这种情况,于是我登陆开发者中心,进去发现说我的账 ...

  8. linux出现user account has expired解决方案

    SUSE Linux 用户user1登陆不了,确认密码没错,使用root用户登陆,su - user1 提示密码不对,passwd user1提示帐户过期user account hasexpired ...

  9. Azure China (4) 管理Azure China Storage Account

    <Windows Azure Platform 系列文章目录> Update 2015-05-10 强烈建议使用AzCopy工具,AzCopy命令行工具,是经过优化的.高性能Azure S ...

  10. Java-集合=第五题 (Map)设计Account 对象如下: private long id; private double balance; private String password; 要求完善设计,使得该Account 对象能够自动分配id。 给定一个List 如下: List list = new ArrayList(); list.add(new A

    第五题 (Map)设计Account 对象如下: private long id; private double balance; private String password; 要求完善设计,使得 ...

随机推荐

  1. P值(P-value),“差异具有显著性”和“具有显著差异”

    郑冰刚提到P值,说P值的定义(着重号是笔者加的,英文是从WikiPedia摘来的): P值就是当原假设为真时,比所得到的样本观察结果更极端的结果出现的概率. The P-value is the pr ...

  2. Informatica 常用组件Source Qualifier之八 Distinct

    如果希望 PowerCenter 从源选择唯一值,您可以使用"选择相异"选项.例如,您可以使用此功能从列出总销售额的表中提取唯一客户标识.使用"选择相异"过滤器 ...

  3. go语言基础之二维数组

    1.二维数组 示例: package main //必须有个main包 import "fmt" func main() { //有多少个[]就是多少维 //有多少个[]就用多少个 ...

  4. [leetcode]Copy List with Random Pointer @ Python

    原题地址:https://oj.leetcode.com/problems/copy-list-with-random-pointer/ 题意: A linked list is given such ...

  5. python 插入数据获取id

    python 插入数据获取id 学习了:https://blog.csdn.net/qq_37788558/article/details/78151972 commit之前获取 cursor.las ...

  6. kindle 电子书去除DRM

    DRM,Digital Rights Management,数字版权管理. amazon购买的图书会下发到你的kindle设备.电子书格式通常为.azw3.里面包括了DRM,仅仅能在你的设备上使用. ...

  7. [Backbone] Parse not formatted JSON code

    The good Dr. recently had another team implement the server and they slightly messed up the format o ...

  8. 2015 -&gt; 2016

    2015年. 2015年前几个月,一直住在三亚,每天过着老年人般的生活. 每天吃饭睡觉看电视遛弯游泳.生活倒也满意. 4月份開始,从三亚一路开车回到上海,开开停停,最后享受了一次沿路的风景和满意. 5 ...

  9. C#.NET常见问题(FAQ)-如何把写好的类编译成dll文件

    1 新建一个类库项目   2 直接改写这个Class1.cs文件   3 记得要添加Windows.Forms引用   4 我直接把在别的项目中做好的cs文件搞到这里来,连文件名也改了(FilesDi ...

  10. ArcMap概化之消除真曲线

    在地理国情项目中,异常折线检查结果中,有报错为:几何类型为esriGeometryCircularArc不合法,而属性表中几何类型(Shape)内容为 "面",这是为何? 作为GI ...