B君要用一个表面积为S的圆锥将白山云包起来。
B君希望包住的白山云体积尽量大,B君想知道体积最大可以是多少。
注意圆锥的表面积包括底面和侧面。
Input
一行一个整数,表示表面积S。(1 <= S <= 10^9)
Output
一行一个实数,表示体积。
Input示例
8
Output示例
1.504506
化简……
S = πr^2 + πrl
V = 1/3 * πr^2 h
由第一步化得, l = S/πr - r
代入第二步得, h = √{S^2/(π^2*r^2) - 2S/π )
将第二步所得代入第三步,
设X = πr^2
则有 V = 1/3* X* √{(S^2*X - 2S*X^2/2)/π}
接下来最关键化这步 S^2*X - 2S*X^2/2
-2S(X^2 - SX/2 + S^2/16 - S^2/16) = S^3 / 8 - 2S * (X - S/4)^2
由于- 2S * (X - S/4)^2 <= 0, 若要使体积最大, 则有当x = S/4时, - 2S * (X - S/4)^2 = 0,V最大。
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<ctime>
#include<string>
#include<stack>
#include<deque>
#include<queue>
#include<list>
#include<set>
#include<map>
#include<cstdio>
#include<limits.h>
#define MOD 1000000007
#define fir first
#define sec second
#define fin freopen("/home/ostreambaba/文档/input.txt", "r", stdin)
#define fout freopen("/home/ostreambaba/文档/output.txt", "w", stdout)
#define mes(x, m) memset(x, m, sizeof(x))
#define Pii pair<int, int>
#define Pll pair<ll, ll>
#define INF 1e9+7
#define Pi 4.0*atan(1.0)
#define lowbit(x) (x&-x)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
typedef long long ll;
typedef unsigned long long ull;
const double eps = 1e-7;
const int maxn = 101;
using namespace std;
//#define time
int main()
{
double S, V;
cin >> S;
V = sqrt(S*S*S/(8*Pi))/3;
printf("%.6f\n", V);
return 0;
}