原来强行转int可以避免四舍五入啊
#include<iostream>
#include<cstdio>
using namespace std;
int r,y;
double m;
int main()
{
scanf("%d%lf%d",&r,&m,&y);
double l=1.0+(double)r/100.0;
for(int i=1;i<=y;i++)
m*=l;
printf("%d\n",(int)m);
return 0;
}
原文地址:https://www.cnblogs.com/lokiii/p/9215679.html
时间: 2024-11-10 10:07:38