文章
121
粉丝
68
获赞
94
访问
20.4k
#include <bits/stdc++.h>
using namespace std;
struct triEdge{
int x1,y1;
int x2,y2;
double length;
triEdge():x1(0),y1(0),x2(0),y2(0),length(0){}
triEdge(int x1,int y1,int x2,int y2){
this->x1 = x1;
this->y1 = y1;
this->x2 = x2;
this->y2 = y2;
this->length = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
}
};
int main(){
int a,b,c,d,e,f;
while(cin>>a>>b>>c>>d>>e>>f){
triEdge te1 = triEdge(a,b,c,d);
triEdge te2 = triEdge(a,b,e,f);
triEdge te3 = triEdge(c,d,e,f);
double p = (te1.length + te2.length + te3.length) / 2;
double s = sqrt(p * (p - te1.length) * (p - te2.length) * (p - te3.length));
printf("%.2lf\n", s);
}
}
登录后发布评论
暂无评论,来抢沙发