原来强行转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;
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-23
  • 2021-07-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-11
  • 2022-12-23
  • 2021-10-17
  • 2021-10-21
  • 2021-06-17
  • 2021-07-19
  • 2021-12-17
相关资源
相似解决方案