POJ 2390-Bank Interest-水

系统管理员 2022-06-05 05:30 242阅读 0赞

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. 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.

Input

* Line 1: Three space-separated integers: R, M, and Y

Output

* Line 1: A single integer that is the number of dollars FJ will have after Y years.

Sample Input

  1. 5 5000 4

Sample Output

  1. 6077
  2. #include<algorithm>
  3. #include<iostream>
  4. #include<cstdio>
  5. #include<cmath>
  6. using namespace std;
  7. int main()
  8. {
  9. int a;
  10. double r,m,y;
  11. scanf("%lf %lf %lf",&r,&m,&y);
  12. a=pow(1+r*0.01,y)*m;
  13. printf("%d",a);
  14. return 0;
  15. }

发表评论

表情:
评论列表 (有 0 条评论,242人围观)

还没有评论,来说两句吧...

相关阅读