#3
ws191033302019-10-28 16:53
回复 2楼 rjsp
我重改了下,问题少了,但还有问题 ,麻烦看看?
#include
#include
float dist(float x1,float y1,float x2,float y2);
int main()
{
float x1,y1,x2,y2,x3,y3;
scanf("%f %f %f %f %f %f",&x1,&y1,&x2,&y2,&x3,&y3);
float a=dist(x1,y1,x2,y2);
float b=dist(x2,y2,x3,y3);
float c=dist(x1,y1,x3,y3);
float s=(a+b+c)/2;
float S=sqrt(s*(s-a)*(s-b)*(s-c));
printf("%.2f",S);
return 0;
}
float dist(float x1,float y1,float x2,float y2)
{
float dist = sqrt(pow(x1-x2,2)+pow(y1-y2,2));
return dist;
}
测试点1 答案正确 312KB 1MS
测试点2 答案错误 308KB 3MS??
测试点3 答案错误 312KB 3MS??
测试点4 答案正确 316KB 3MS
测试点5 答案正确 304KB 3MS
测试点6 答案正确 308KB 3MS
测试点7 答案正确 308KB 3MS
测试点8 答案正确 312KB 4MS
测试点9 答案正确 316KB 3MS
测试点10 答案正确 320KB 3MS