1 /* 2 Name:nyoj-67-三角形面积 3 Copyright: 4 Author: 5 Date: 2018/4/26 16:44:47 6 Description: 7 三角形的三个顶点坐标求其面积的公式为: 8 S=(1/2)*(x1y2+x2y3+x3y1-x1y3-x2y1-x3y2) 9 */ 10 #include <iostream> 11 #include <cstdio> 12 using namespace std; 13 int main() 14 { 15 int x1,x2,x3,y1,y2,y3; 16 while (cin>>x1>>y1>>x2>>y2>>x3>>y3, x1+x2+x3+y1+y2+y3) { 17 double ans = x1*y2 + x2*y3 + x3*y1 -x1*y3 - x2*y1 - x3*y2; 18 printf("%.1f ", ans/2>0?ans/2:-ans/2); 19 } 20 return 0; 21 }