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. linux的chmod,chown命令详解

    指令名称 : chmod 使用权限 : 所有使用者 使用方式 : chmod [-cfvR] [--help] [--version] mode file... 说明 : Linux/Unix 的档案 ...

  2. spark调优经验(待续)

    spark调优是须要依据业务须要调整的,并非说某个设置是一成不变的,就比方机器学习一样,是在不断的调试中找出当前业务下更优的调优配置.以下零碎的总结了一些我的调优笔记. spark 存储的时候存在严重 ...

  3. [leetcode]Valid Number @ Python

    原题地址:http://oj.leetcode.com/problems/valid-number/ 题意:判断输入的字符串是否是合法的数. 解题思路:这题只能用确定有穷状态自动机(DFA)来写会比较 ...

  4. Balanced Binary Tree leetcode java

    题目: Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced bin ...

  5. 13个可实现超棒数据可视化效果的Javascript框架

    随着商业及其相关需求的发展,数据成为越来越重要的元素之一,为了更加直观和明显的展示商业潜在的趋势和内在的特性,我们需要使用图表和图形的方式来直观动态的展示数据内在秘密,在今天的这篇文章中我们推荐12款 ...

  6. Python3 写Windows Service服务程序

    用Python开发Windows Service,用Python来做这个事情必须要借助第三方模块pywin32,下载路径:https://pypi.org/project/pywin32/#files ...

  7. 【Struts2学习笔记(9)】单文件上传和多文件上传

    (1)单文件上传 第一步:在WEB-INF/lib下增加commons-fileupload-1.2.1.jar.commons-io-1.3.2.jar. 这两个文件能够从http://common ...

  8. 在Linux上使用iptables命令开启对外访问的网络端口

    如果linux下没有开启对某端口访问权限,你可以通过下面的命令可以开启允许对外访问的网络端口,示例如下: [root@asg76 sysconfig]# iptables -I INPUT -p tc ...

  9. Graphical vi-vim Cheat Sheet and Tutorial

    主要内容: VIM编辑器的快捷命令cheat sheet(小抄),一共七张图,简单明了地介绍了vim的快捷命令,相比于满满的图表,分成七小块更易于记住. 更多关于vim的cheat sheet以及相关 ...

  10. shell中使用if判断时用到的一些参数

    shell 编程中使用到得if语句内判断参数 –b 当file存在并且是块文件时返回真 -c 当file存在并且是字符文件时返回真 -d 当pathname存在并且是一个目录时返回真 -e 当path ...