hdoj1077 The area
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
int T;
double x1, x2, x3, y1, y2, y3, a, b, c, ans;
scanf("%d", &T);
while (T--) {
scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
a = (y3 - y1) / ((x3 - x1) * (x3 - x1));
b = -2 * a * x1;
c = y1 + (b * b) / (4 * a);
double d = (y2 + y3) * (x3 - x2) / 2;
ans =
a / 3 * (x3 * x3 * x3 - x2 * x2 * x2) + b / 2 * (x3 * x3 -
x2 * x2) +
c * (x3 - x2) - d;
if (ans < 0)
ans *= -1;
printf("%.2lf\n", ans);
}
}
#include<stdio.h>
using namespace std;
int main()
{
int T;
double x1, x2, x3, y1, y2, y3, a, b, c, ans;
scanf("%d", &T);
while (T--) {
scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
a = (y3 - y1) / ((x3 - x1) * (x3 - x1));
b = -2 * a * x1;
c = y1 + (b * b) / (4 * a);
double d = (y2 + y3) * (x3 - x2) / 2;
ans =
a / 3 * (x3 * x3 * x3 - x2 * x2 * x2) + b / 2 * (x3 * x3 -
x2 * x2) +
c * (x3 - x2) - d;
if (ans < 0)
ans *= -1;
printf("%.2lf\n", ans);
}
}