题目如下
A. Parallelepiped
time limit per test2 seconds
memory limit per test256 megabytes
You've got a rectangular parallelepiped with integer edge lengths. You know the areas of its three faces that have a common vertex. Your task is to find the sum of lengths of all 12 edges of this parallelepiped.
Input
The first and the single line contains three space-separated integers — the areas of the parallelepiped's faces. The area's values are positive ( > 0) and do not exceed 104. It is guaranteed that there exists at least one parallelepiped that satisfies the problem statement.
Output
Print a single number — the sum of all edges of the parallelepiped.
题目大意
一个数学题,给顶一个长方体的三个相邻的共顶点的面的面积,求这个长方体的三边长并输出总的边长和。
题目分析
三面面积之积就等于三边长积的平方。
点击查看代码
#include <iostream>
#include <cmath>
using namespace std;int main() {int ab, bc, ac;cin >> ab >> bc >> ac;int a = sqrt( ab * ac / bc);int b = sqrt( ab * bc / ac);int c = sqrt( bc * ac / ab);int ans = 4 * (a + b + c);cout << ans << endl;return 0;
}