文章

43

粉丝

180

获赞

21

访问

179.6k

头像
c++
P1443 北京理工大学机试题
发布于2022年4月30日 15:06
阅读数 3.5k

#include <iostream>
#include <cmath>
using namespace std;
int n, h;
double s;
int main()
{
	cin >> n;
	while (cin >> h >> n)
	{
		s = h;
		while (--n) s += pow(0.5, n - 1) * h;
		printf("%.2f\n", s);
	}
	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发