poj 2390 Bank Interest

简介:

做这种题目,有一种回到大一时候的感觉。。。

唯一需要注意的就是c语言中的取整,对于一个double型的数据,直接在前面用(int)就可以了。。。


#include <stdio.h>

int main()
{
	int R,M,Y;
	scanf("%d%d%d",&R,&M,&Y);

	double rate=(double)R/100+1.0;

	double result=M;

	while(Y--)
		result*=rate;

	printf("%d\n",(int)result);

	return 0;
}



相关文章
POJ 2390 Bank Interest
POJ 2390 Bank Interest
111 0
POJ 2390 Bank Interest
Problem Description Farmer John made a profit last year! He would like to invest it well but wonders how much money he will make.
826 0
|
Java 知识图谱
|
9月前
|
C++
HDU2319— Card Trick
HDU2319— Card Trick
|
9月前
|
知识图谱
Piggy-Bank(HDU--1114)
Piggy-Bank(HDU--1114)
POJ 1276 Cash Machine 解答
题目详见: http://poj.org/problem?id=1276 这道题与POJ 1014同属一类题, 区别在于POJ 1014的解是求恰好等于容量的情况, 而这道题较为常规, 同时这道题的数据较大, 套用我在博客http://blog.
905 0
|
JavaScript IDE 开发工具
UVA 12482 Short Story Competition
给你一篇短故事,求至少需要几页纸才能容纳这篇段故事,已知短故事有N个单词,每页能容纳L行,每行能容纳C个字符,这里要注意每个单词后有一个空格,一个单词只能在同一行。
154 0
hdu 1114 Piggy-Bank(完全背包)
点击打开链接hdu1114 思路: 裸完全背包 代码: #include #include #include #include using namespace std; const int INF = 0x3f3f3f3f; cons...
1011 0

热门文章

最新文章