十七周周赛A——Parallelepiped

虽然是水题,但是还是想把这灵光一现的想法记录下来。。

Description

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.

Sample Input

Input
1 1 1
Output
12
Input
4 6 6
Output
28
1
2
3
4
5
6
7
8
9
10
11
12
#include <stdio.h>
#include <math.h>
int main()
{
    int x, y, z, a, b, c;
    scanf("%d%d%d",&x,&y,&z);
    a = sqrt((double)x / y * z);
    b = sqrt((double)x / z * y);
    c = y / b;
    printf("%d\n",4*(a+b+c));
    return 0;
}

你可能感兴趣的:(编程,C语言)