解题思路:
题目是按解题思路来的 注意事项: 注意是输出两位小数,而不是保留两位小数
参考代码:
#include<iostream> #include<iomanip> #include<cstdio> #include<cmath> using namespace std; int main() { int k; double p; int n; int m; cin>>k>>n>>p; m=n; double total=k; while(n--) { total*=(1+p); total+=k; } total-=k; total=total-(k*m); total=floor(total*100); total=total/100; cout<<total<<endl; return 0; }
0.0分
0 人评分