3 条题解

  • 8
    #include <iostream>
    #include <iomanip>
    #include <cmath>
    using namespace std;
    int main()
    {
        float X1,Y1,X2,Y2,X3,Y3,p;
        float a,b,c;
        cin >>X1>>Y1>>X2>>Y2>>X3>>Y3;
        a=sqrt(pow((X1-X2),2)+pow((Y1-Y2),2));
        b=sqrt(pow((X1-X3),2)+pow((Y1-Y3),2));
        c=sqrt(pow((X2-X3),2)+pow((Y2-Y3),2));
        p=(a+b+c)/2;
        cout<<fixed<<setprecision(2)<<sqrt(p*(p-a)*(p-b)*(p-c));
        return 0;
    }
    
    
  • -1
    @ 2024-10-27 10:43:02

    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    double x1,y1,x2,y2,x3,y3;
    cin>>x1>>y1>>x2>>y2>>x3>>y3;
    cout<<setprecision(2)<<fixed<<fabs(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))/2;
    return 0;
    }

  • -6

    #include <iostream>
    #include <iomanip>
    #include <cmath>
    using namespace std;
    int main()
    {
    float x1,x2,x3,y1,y2,y3,a,b,c,p,s;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    a = sqrt(pow((x1-x2),2)+pow((y1-y2),2));
    b = sqrt(pow((x2-x3),2)+pow((y2-y3),2));
    c = sqrt(pow((x3-x1),2)+pow((y3-y1),2));
    p = (a+b+c)/2;
    s = sqrt(p*(p-a)*(p-b)*(p-c));
    cout << fixed << setprecision(2) << s << endl;
    return 0;
    }//就差一个就对了,帮我看看题解发下

  • 1

信息

ID
2326
难度
4
分类
(无)
标签
递交数
179
已通过
82
通过率
46%
被复制
2
上传者