POJ 2390 Bank Interest

简介: 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. 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;
}
目录
相关文章
|
6月前
|
Java 数据挖掘 知识图谱
HDU 1114 Piggy-Bank (完全背包)
HDU 1114 Piggy-Bank (完全背包)
31 0
|
6月前
|
知识图谱
Piggy-Bank(HDU--1114)
Piggy-Bank(HDU--1114)
|
6月前
|
C++
HDU2319— Card Trick
HDU2319— Card Trick
|
存储 供应链 C++
【PAT甲级 - C++题解】1079 Total Sales of Supply Chain
【PAT甲级 - C++题解】1079 Total Sales of Supply Chain
88 0
|
存储 供应链 C++
【PAT甲级 - C++题解】1106 Lowest Price in Supply Chain
【PAT甲级 - C++题解】1106 Lowest Price in Supply Chain
78 0
|
人工智能 BI
AtCoder Beginner Contest 216 F - Max Sum Counting (降维 背包dp)
AtCoder Beginner Contest 216 F - Max Sum Counting (降维 背包dp)
130 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.
1297 0