close

題目:0001.jpg

思路:  這題很單純數學題,不過要注意數字大小,用long long 。

照題目要求計算即可AC,水題

代碼:

#include <bits/stdc++.h>

using namespace std;

int main()
{
    long double r, n, p;
    while(cin >> r >> n >> p){
        double ans = 0.0;
        r += 1.0;
        for(int i = 0; i < n; ++i){
            ans = (ans + p) * r;
        }
        cout << (long long)ans << endl;
    }
    return 0;
}

 

arrow
arrow
    創作者介紹
    創作者 尾玉 的頭像
    尾玉

    louisfghbvc的部落格

    尾玉 發表在 痞客邦 留言(0) 人氣()