题目描述:
B君要用一个表面积为S的圆锥将白山云包起来。
B君希望包住的白山云体积尽量大,B君想知道体积最大可以是多少。
注意圆锥的表面积包括底面和侧面。
输入
一行一个整数,表示表面积S。(1 <= S <= 10^9)
输出
一行一个实数,表示体积。
输入样例
8
输出样例
1.504506
题解:
用已知的圆锥面积S,求得最大的体积,
首先需要知道圆锥的表面积和体积公式:
然后写出推导过程,这里我直接借用其他人的图片
代码:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <deque>
#include <list>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <iterator>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1.0);
const double E = exp(1.0);
const int MOD = 1e9+7;
const int MAX = 1e5+5;
double s;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> s;
double V_max = sqrt((s*s*s)/(8*PI)) / 3;
printf("%.6f\n",V_max);
//printf("%f\n",V_max);
//cout.setf(ios::fixed);
//cout << fixed << setprecision(6) << V_max << endl;
return 0;
}