2 条题解

  • 7
    #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;
    }
    
    
  • -7

    #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
难度
3
分类
(无)
标签
递交数
159
已通过
76
通过率
48%
被复制
2
上传者