NUC1373 Bank Interest【水题】

2024-04-08 22:18
文章标签 水题 interest bank nuc1373

本文主要是介绍NUC1373 Bank Interest【水题】,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

Bank Interest

时间限制: 1000ms 内存限制: 65535KB
通过次数: 1总提交次数: 1
问题描述
Farmer John made a profit last year! He would like to invest it well but wonders how much money he will make. He knows the interest rate R (an integer between 0 and 20) that is compounded annually at his bank. He has an integer amount of money M in the range 100..1,000,000. He knows how many years Y (range: 0..400) he intends to invest the money in the bank. Help him learn how much money he will have in the future by compounding the interest for each year he saves. Print an integer answer without rounding. Answers for the test data are guaranteed to fit into a signed 32 bit integer.
输入描述
* Line 1: Three space-separated integers: R, M, and Y
输出描述
* Line 1: A single integer that is the number of dollars FJ will have after Y years.
样例输入
5 5000 4
样例输出
6077
来源
USACO 2004 November Gold
提示
INPUT DETAILS:

5% annual interest, 5000 money, 4 years

OUTPUT DETAILS:

Year 1: 1.05 * 5000 = 5250
Year 2: 1.05 * 5250 = 5512.5
Year 3: 1.05 * 5512.50 = 5788.125
Year 4: 1.05 * 5788.125 = 6077.53125
The integer part of 6077.53125 is 6077.


问题分析:(略)

这个问题和《POJ2390 Bank Interest【水题】》是同一个问题,代码直接用就AC了。

程序说明:参见参考链接。

参考链接:POJ2390 Bank Interest【水题】

题记:程序做多了,不定哪天遇见似曾相识的。

AC的C++程序如下:

/* POJ2390 Bank Interest */#include <iostream>
#include <cmath>using namespace std;int main()
{int r, m, y;cin >> r >> m >> y;cout << (int)(m * pow(1 + r / 100.0, y)) << endl;return 0;
}




这篇关于NUC1373 Bank Interest【水题】的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/886539

相关文章

uva 10055 uva 10071 uva 10300(水题两三道)

情歌两三首,水题两三道。 好久没敲代码了为暑假大作战热热身。 uva 10055 Hashmat the Brave Warrior 求俩数相减。 两个debug的地方,一个是longlong,一个是输入顺序。 代码: #include<stdio.h>int main(){long long a, b;//debugwhile(scanf("%lld%lld", &

Codeforces Round #182 (Div. 2)A(水题)

题目链接:http://codeforces.com/contest/302/problem/A 解题思路: 只要通过重新排列使区间内和为0即是1,否则是0. 完整代码: #include <algorithm>#include <iostream>#include <cstring>#include <complex>#include <cstdio>#inc

HDU 2064 汉诺塔III(水题)

题目: http://acm.hdu.edu.cn/showproblem.php?pid=2064 题目大意: 有三根杆,求把n个圆盘从左边移到右边,最少需要移动圆盘的次数。移动规则为大盘不能放在小盘上,比原始的汉诺塔题改变的地方是,只能通过中间的杆往左右两边的杆移动。 心得: 此题心得在题外,不在题内,初看此题,尼玛吓了一跳,好像很难的样子,手贱百度了一下,只注意到俩字“水题”,赶紧

SIM(Search-based user interest modeling)

导读 我们对电商场景兴趣建模的理解愈发清晰:1. 通过预估目标item的信息对用户过去的行为做search提取和item相关的信息是一个很核心有效的技术。2. 更长的用户行为序列信息对CTR建模是非常有效且珍贵的。从用户的角度思考,我们也希望能关注用户长期的兴趣。但是当前的search方法无论是DIN和DIEN都不允许我们在线对一个超长的行为序列比如1000以上做有效搜索。所以我们的目标就比较明

DDR的Controller、Channel、Chip、Rank、Bank、Row、Column、Sided、Dimm

目录 概览 1.概览             先从半导体生产开始,生产出来还没切割的叫晶圆(wafer)。切割出来还没封装的叫裸die(bare die)。封装好的叫颗粒(component)。做成内存条后叫模组(module)。下文我们也会按这样的称呼去区分。 2.Controller(内存控制器)         一开始内存控制器在主板上有独立的芯片;在英特尔微处理器

【SGU】115. Calendar 水题= =

传送门:【SGU】115. Calendar 题目分析:2001年1月1号星期1,然后就没什么好说的了= = 代码如下: #include <map>#include <vector>#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>using namespac

Codeforces Round #256 (Div. 2/A)/Codeforces448A_Rewards(水题)

解题报告 意思就是说有n行柜子,放奖杯和奖牌,要求每行柜子要么全是奖杯要么全是奖牌,而且奖杯每行最多5个,奖牌最多10个。 直接把奖杯奖牌各自累加,分别出5和10,向上取整和N比较 #include <iostream>#include <cstdio>#include <cstring>#include <stdlib.h>#include <algorithm>

hdu 1013(水题)

题意:求一个数,各个数位相加,如果结果小于10则输出,否者递归进行数位相加。   #include <cstdio>#include <cstring>#include <string>#include <iostream>using namespace std;int result(int n){int sum = 0;while (n > 0){sum += n % 1

HDU 1008(水题)

题意:给一个数n,后跟着n个数,代表电梯要到的层数,如果是上升,则每层花费6分钟,下降每层划分4分钟,停着话费5分钟,求电梯总共花费多少时间。   #include <iostream>using namespace std;void main(){int n, m, t, total;while (cin >> n && n != 0){m = 0;total = 0;wh

HDU 1001(水题)

题意:输入n,求1~n之和。 import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner s=new Scanner(System.in);int n=0;int sum;while(s.hasNextInt()){sum=0;n=s.nextInt();