基准时间限制:1 秒 空间限制:131072 KB 分值: 10
难度:2级算法题
B君要用一个表面积为S的圆锥将白山云包起来。
B君希望包住的白山云体积尽量大,B君想知道体积最大可以是多少。
注意圆锥的表面积包括底面和侧面。
Input
一行一个整数,表示表面积S。(1 <= S <= 10^9)
Output
一行一个实数,表示体积。
Input示例
8
Output示例
1.504506
题解:小学生几何题都不会推了,QAQ/(ㄒoㄒ)/~~ 推导过程
代码如下:
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
const double pi = 4.0*atan(1);
int main()
{
double s;
while(scanf("%lf",&s)!=EOF)
{
double r = sqrt(s/(4*pi));
double h = sqrt( (s*s/(pi*pi*r*r)) - (2*s/pi) );
double v = h*pi*r*r/3;
printf("%.6f\n",v);
}
return 0;
}