2 solutions
-
2
#include <stdio.h> #include <math.h> int main() {//用float设x,结果会有零点几的误差 double x1,x2,x3,y1,y2,y3,a=0,b=0,c=0,sum=0,i=0; scanf("%lf %lf %lf %lf %lf %lf", &x1,&y1,&x2,&y2,&x3,&y3); a=sqrt(pow(x2-x1,2)+pow(y2-y1,2)); b=sqrt(pow(x3-x1,2)+pow(y3-y1,2)); c=sqrt(pow(x2-x3,2)+pow(y2-y3,2)); i=(a+b+c)/2.0; sum=sqrt(i*(i-a)*(i-b)*(i-c)); printf("%.2f",sum); return 0; }
Information
- ID
- 6726
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 8
- Tags
- (None)
- # Submissions
- 512
- Accepted
- 82
- Uploaded By