给定半径为R的球体,任务是找出可以外接的最小圆锥体体积。
例子:
输入: R = 10输出:圆锥体的体积= 8373.33说明:圆锥体的半径= 14.14,圆锥体的高度= 40,圆锥体的体积= 因此,体积= 8373.33输入: R = 4输出:圆锥体的体积= 535.89
方法:
我们给出了一个用圆锥体表示的半径为R的球体。我们需要找出圆锥的半径和高度,以找出圆锥的体积。
- 在三角形AOE和ALC中计算sin(X),即对于三角形AOE 对于三角形ALC
- 现在,通过将两者相等,我们得到
- 在Volume中插入H的值,即并将体积最小化 。
- 从上面的等式我们可以得到并将这个值放在H中,我们得到
- 因此,应用圆锥体积和推杆的公式和我们得到理想的结果。
C++
// C++ program to find the minimum
// volume of the cone that can be
// circumscribed about a sphere
// of radius R
#include
using namespace std;
// Function to find the volume
// of the cone
float Volume_of_cone(float R)
{
// r = radius of cone
// h = height of cone
// Volume of cone = (1 / 3) * (3.14) * (r*r) * (h)
// we get radius of cone from the derivation
// is root(2) times multiple of R
// we get height of cone from the derivation
// is 4 times multiple of R
float V = (1 / 3.0) * (3.14) * (2 * ( R * R ) ) * (4 * R);
return V;
}
// Driver code
int main()
{
float R = 10.0;
cout << Volume_of_cone(R);
}
// This code is contributed by Samarth
Java
// Java program to find the minimum
// volume of the cone that can be
// circumscribed about a sphere
// of radius R
import java.util.*;
class GFG{
// Function to find the volume
// of the cone
static double Volume_of_cone(double R)
{
// r = radius of cone
// h = height of cone
// Volume of cone = (1 / 3) * (3.14) * (r*r) * (h)
// we get radius of cone from the derivation
// is root(2) times multiple of R
// we get height of cone from the derivation
// is 4 times multiple of R
double V = (double)((1 / 3.0) * (3.14) * (2 * (R * R)) *
(4 * R));
return V;
}
// Driver code
public static void main(String[] args)
{
double R = 10.0;
System.out.print(Volume_of_cone(R));
}
}
// This code is contributed by sapnasingh4991
Python3
# Python3 program to find the minimum
# Volume of the cone that can be circumscribed
# about a sphere of radius R
import math
# Function to find the volume
# of the cone
def Volume_of_cone(R):
# r = radius of cone
# h = height of cone
# Volume of cone = (1 / 3) * (3.14) * (r**2) * (h)
# we get radius of cone from the derivation
# is root(2) times multiple of R
# we get height of cone from the derivation
# is 4 times multiple of R
V = (1 / 3) * (3.14) * (2 * ( R**2 ) ) * (4 * R)
return V
# Driver code
if __name__ == "__main__":
R = 10
print(Volume_of_cone(R))
C#
// C# program to find the minimum
// volume of the cone that can be
// circumscribed about a sphere
// of radius R
using System;
class GFG{
// Function to find the volume
// of the cone
static double Volume_of_cone(double R)
{
// r = radius of cone
// h = height of cone
// Volume of cone = (1 / 3) * (3.14) * (r*r) * (h)
// we get radius of cone from the derivation
// is root(2) times multiple of R
// we get height of cone from the derivation
// is 4 times multiple of R
double V = (double)((1 / 3.0) * (3.14) *
(2 * (R * R)) * (4 * R));
return V;
}
// Driver code
public static void Main()
{
double R = 10.0;
Console.Write(Volume_of_cone(R));
}
}
// This code is contributed by Nidhi_biet
Javascript
输出:
8373.333333333332