Nyoj 673 Angular Area "triangular area formula"

Source: Internet
Author: User

Triangle Area time limit:MS | Memory limit:65535 KB Difficulty:2
Describe
give you three points, representing the three vertices of a triangle, now your task is to find out the area of the triangle.
Input
each row is a set of test data, with 6 integer x1,y1,x2,y2,x3,y3 representing the horizontal ordinate of three points, respectively. (Coordinate values from 0 to 10000)
Input 0 0 0 0 0 0 indicates end of input
No more than 10000 test data sets
Output
outputs the area of the triangle represented by these three points, resulting in a precision of 1 digits after the decimal point (even if an integer is a
decimal digit)
Sample input
0 0 1 1 1 30 1 1 0 0 00 0 0 0 0 0
Sample output
1.00.5
Source
Computational Geometry Basics
Uploaded by
Zhang Yunzun
mainly in the area of the Triangle formula set three vertices for O a B is the area of OA fork by the OB,

xi=x1-x3;
Yi=y1-y3;
xj=x2-x3;
Yj=y2-y3;

| Xi Yi |
| XJ YJ |
s== (*|) (Xi*yj-xj*yi) | ((Xi*yj-xj*yi) to seek absolute value)
#include <stdio.h> #include <math.h> #define LL long Longint main () {int x1,x2,x3,y1,y2,y3;double sum;double Xi,yi,xj,yj;while (scanf ("%d%d%d%d%d%d", &x1,&y1,&x2,&y2,&x3,&y3)) {if (x1==0&&y1= =0&&x2==0&&y2==0&&x3==0&&y3==0) break;xi=x1-x3;yi=y1-y3;xj=x2-x3;yj=y2-y3;sum= Fabs (XI*YJ-YI*XJ)/2.0;printf ("%.1lf\n", Sum);}}

  

Nyoj 673 Angular area "Triangle area Formula"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.