每日刷题(七十六)
ALGO-200、预测身高
详细C++代码如下:
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int gender;
float pap, mom;
float height;
cin >> gender >> pap >> mom;
if(gender)
{
height = (pap + mom) / 2 * 1.08;
cout << fixed << setprecision(3) << height << endl;
}
else
{
height = (pap * 0.923 + mom) / 2;
cout << fixed << setprecision(3) << height << endl;
}
return 0;
}
部分样例运行结果如下: