日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

NUC1373 Bank Interest【水题】

發布時間:2025/3/20 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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; }



轉載于:https://www.cnblogs.com/tigerisland/p/7563669.html

總結

以上是生活随笔為你收集整理的NUC1373 Bank Interest【水题】的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。