本文主要是介绍十七周周赛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
1 1 1
12
4 6 6
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;
}
这篇关于十七周周赛A——Parallelepiped的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!