标签:
0 0 1 1 1 3 0 1 1 0 0 0 0 0 0 0 0 0
1.0 0.5
1 #include <cmath> 2 #include <cstdio> 3 #include <cstring> 4 using namespace std; 5 int main() 6 { 7 double x1, y1, x2, y2, x3, y3; 8 while(~scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3)) 9 { 10 if(x1 == 0 && x2 == 0 && x3 == 0 && y1 == 0 && y2 == 0 && y3 == 0) 11 break; 12 double s, sum = 0, c1, c2, c3; 13 c1 = sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2)); 14 c2 = sqrt((x1 - x3)*(x1 - x3) + (y1 - y3)*(y1 - y3)); 15 c3 = sqrt((x2 - x3)*(x2 - x3) + (y2 - y3)*(y2 - y3)); 16 sum = sum + c1 + c2 + c3; 17 sum /= 2.0; 18 s = sqrt(sum * (sum - c1) * (sum - c2) * (sum - c3)); 19 printf("%.1lf\n", s); 20 } 21 return 0; 22 }
标签:
原文地址:http://www.cnblogs.com/fengshun/p/4729228.html