给定三个半轴的长度为A 、 B和C ,任务是找到给定椭圆体的表面积。
Ellipsoid is a closed surface of which all plane cross-sections are either ellipses or circles. An ellipsoid is symmetrical about the three mutually perpendicular axes that intersect at the center. It is a three-dimensional, closed geometric shape, all planar sections of which are ellipses or circles.
An ellipsoid has three independent axes, and is usually specified by the lengths a, b, c of the three semi-axes. If an ellipsoid is made by rotating an ellipse about one of its axes, then two axes of the ellipsoid are the same, and it is called an ellipsoid of revolution, or spheroid. If the lengths of all three of its axes are the same, it is a sphere.
例子:
Input: A = 1, B = 1, C = 1
Output: 12.57
Input: A = 11, B = 12, C = 13
Output: 1807.89
方法:给定的问题可以通过使用椭球表面积的公式来解决:
下面是上述方法的实现:
C++
// C++ program for the above approach
#include
#include
#include
using namespace std;
// Function to find the surface area of
// the given Ellipsoid
void findArea(double a, double b, double c)
{
// Formula to find surface area
// of an Ellipsoid
double area = 4 * 3.141592653
* pow((pow(a * b, 1.6) + pow(a * c, 1.6)
+ pow(b * c, 1.6))
/ 3,
1 / 1.6);
// Print the area
cout << fixed << setprecision(2)
<< area;
}
// Driver Code
int main()
{
double A = 11, B = 12, C = 13;
findArea(A, B, C);
return 0;
}
1807.89
时间复杂度: O(1)
辅助空间: O(1)
如果您希望与专家一起参加现场课程,请参阅DSA 现场工作专业课程和学生竞争性编程现场课程。