Dada una esfera de radio R, la tarea es encontrar el volumen mínimo del cono que se puede circunscribir alrededor de ella.
Ejemplos:
Input: R = 10 Output: Volume of cone = 8373.33 Explanation: Radius of cone = 14.14 and Height of cone = 40, Volume of cone = So, volume = 8373.33Input: R = 4 Output: Volume of cone = 535.89
Planteamiento:
hemos dado una esfera de radio R inscrita en Cono. Necesitamos encontrar el radio y la altura del cono para encontrar el volumen del cono.
- En el triángulo AOE y ALC calcule sin(X), es decir, para el triángulo AOE y para el triángulo ALC
- Ahora, al igualar ambos obtenemos
- Inserte el valor de H en Volumen, es decir, y para que el volumen sea mínimo .
- De la ecuación anterior obtenemos y poniendo este valor en H obtenemos
- Por lo tanto, aplicando la fórmula de volumen de cono y poniendo y obtenemos el resultado deseado.
C++
// C++ program to find the minimum // volume of the cone that can be // circumscribed about a sphere // of radius R #include<bits/stdc++.h> 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
<script> // Javascript program to find the minimum // volume of the cone that can be // circumscribed about a sphere // of radius R // Function to find the volume // of the cone function Volume_of_cone( 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 let V = ((1 / 3.0) * (3.14) * (2 * (R * R)) * (4 * R)); return V; } // Driver code let R = 10.0; document.write(Volume_of_cone(R)); // This code is contributed by 29AjayKumar </script>
Producción:
8373.333333333332
Complejidad temporal : O(1) desde la realización de operaciones constantes
Publicación traducida automáticamente
Artículo escrito por virusbuddha y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA