4323 - 기하: 삼각형의 넓이

Time Limit: 1s Memory Limit: 128MB

Submissions: 1185 Solved: 600
Description

삼각형을 이루는 3개의 점 (x1, y1), (x2, y2), (x3, y3) 를 입력받아, 그 넓이를 계산하는 프로그램을 작성하세요. 삼각형의 넓이를 구하는 공식은 다음과 같습니다. 

Write a program that prompts the user to enter three points (x1, y1), (x2, y2), (x3, y3) of a triangle and displays its area. The formula for computing the area of a triangle is

s = (side1 + side2 + side3)/2

area = sqrt(s(s - side1)(s - side2)(s - side3))

Input

* Line 1 : 첫번째 점의 좌표 x y 두번째 점의 좌표 x y 세번째 점의 좌표 x y 

(각 좌표의 x y는 각각 절대값이 100보다 작은 실수이며 공백으로 구분됨)

Output

* Line 1 : 삼각형의 넓이를 나타내는 실수 (소수점 첫째자리 아래는 버림, 예: 11.213의 경우 11.2로 출력, 11.0의 경우 11.0로 출력)

 

Sample Input
1.5 -3.4
4.6 5
9.5 -3.4
Sample Output
33.6
Hint

소수점 한자리까지 출력 System.out.printf("%.1f\n", 0.6789);

Source

JAVA2015 PE2.19