解题思路:
注意事项:
参考代码:
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cmath>
using namespace std;
int main()
{
int i;
double m,n,height,sum=0;
cin>>m>>n;
height=m;
for(i=0;i<n;i++)
{
if(i==0)
sum+=height;
else
sum+=height*2;
height/=2.0;
}
cout<<fixed<<setprecision(2)<<height<<" "<<sum<<endl;
}
0.0分
0 人评分
数组输出 (C语言代码)--此题的题目描述有问题浏览:1817 |
不会做的浏览:875 |
字符串的输入输出处理 (C语言代码)浏览:945 |
WU-拆分位数 (C++代码)浏览:786 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:660 |
用筛法求之N内的素数。 (C语言代码)浏览:808 |
简单的a+b (C语言代码)浏览:577 |
C语言训练-亲密数 (C语言代码)浏览:682 |
母牛的故事 (C语言代码)浏览:551 |
1908题解浏览:640 |