游客 Signup | Login
中文 | En

1134 - C语言4.9

输入三角形的三边长,使用海伦公式计算三角形的面积。

Input

只有一行,用空格分开的三个浮点数,分别为三角形的三边长。输入保证三角形不会退化。

Output

输出三角形的面积,保留2位小数。

请注意行尾输出换行。

Examples

Input

3 4 6

Output

5.33

Solution C

#include<stdio.h>
#include<math.h>
int main(){
double a,b,c,s,L;
scanf("%lf %lf %lf",&a,&b,&c);
s=(a+b+c)/2;
L=sqrt(s*(s-a)*(s-b)*(s-c));
printf("%.2lf",L);
return 0;
}

Solution C++

#include <stdio.h>
#include <math.h>
int main() {
	float a, b, c, s, area;
	scanf("%f %f %f", &a, &b, &c);
	s = (a + b + c) * 0.5;
	area = sqrt(s * (s - a) * (s - b) * (s - c));
	printf("%.2f\n", area);
	return 0;
}

Time Limit 1 second
Memory Limit 32 MB
Discuss Stats
上一题 下一题