B君的圆锥
wwwwodddd (命题人)
基准时间限制:1 秒 空间限制:131072 KB 分值: 40
B君要用一个表面积为S的圆锥将白山云包起来。
B君希望包住的白山云体积尽量大,B君想知道体积最大可以是多少。
注意圆锥的表面积包括底面和侧面。
Input
一行一个整数,表示表面积S。(1 <= S <= 10^9)
Output
一行一个实数,表示体积。
Input示例
8
Output示例
wwwwodddd (命题人)
基准时间限制:1 秒 空间限制:131072 KB 分值: 40
B君要用一个表面积为S的圆锥将白山云包起来。
B君希望包住的白山云体积尽量大,B君想知道体积最大可以是多少。
注意圆锥的表面积包括底面和侧面。
Input
一行一个整数,表示表面积S。(1 <= S <= 10^9)
Output
一行一个实数,表示体积。
Input示例
8
Output示例
1.504506
代码:
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
using namespace std;
const double PI=acos(-1.0);
int main()
{
int s;
while(~scanf("%d",&s))
{
double x=(s*(sqrt((1.0*s*PI)/2)))/(6*PI);///套用公式
printf("%lf\n",x);
}
return 0;
}