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.

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
5 5000 4

Sample Output
6077

#include <stdio.h>
#include <stdlib.h>

int main(){
    int y;
    double r,m;
    scanf("%lf%lf%d",&r,&m,&y);
    int i;
    for(i=0;i<y;i++){
        m+=m*(r/100.0);
    }
    int a=(int)m;
    printf("%d\n",a);
    return 0;
}
目录
相关文章
|
1月前
|
知识图谱
Piggy-Bank(HDU--1114)
Piggy-Bank(HDU--1114)
|
1月前
|
C++
HDU2319— Card Trick
HDU2319— Card Trick
HDU-1057,A New Growth Industry(理解题意)
HDU-1057,A New Growth Industry(理解题意)
POJ 2390 Bank Interest
POJ 2390 Bank Interest
91 0
|
Java 知识图谱
|
Java
2017 Multi-University Training Contest - Team 9 1002&&HDU 6162 Ch’s gift【树链部分+线段树】
Ch’s gift Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1354    Accepted Submission(s): 496 Problem Description Mr.
1277 0
|
Java
2017 Multi-University Training Contest - Team 9 1005&&HDU 6165 FFF at Valentine【强联通缩点+拓扑排序】
FFF at Valentine Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1060    Accepted Submission(...
1185 0
|
Java
2017 Multi-University Training Contest - Team 9 1003&&HDU 6163 CSGO【计算几何】
CSGO Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 127    Accepted Submission(s): 20 Pro...
1392 0