给定半径为 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