4 条题解

  • 5

    #include<iostream>
    #include<cmath>
    #include<iomanip>
    using namespace std;
    int main()
    {
    int a,b,c;
    double p,s;
    cin>>a>>b>>c;
    if(a+b>c&&a+c>b&&b+c>a)
    {
    p=(a+b+c)/2;
    s=sqrt(p*(p-a)*(p-b)*(p-c));
    cout<<fixed<<setprecision(2)<<s<<endl;
    }
    else
    cout<<"NO"<<endl;

    return 0;
    }

  • 1
    @ 2022-07-01 14:42:15

    #include<bits/stdc++.h>
    using namespace std;
    int main( )
    {
    double a,b,c;
    cin >> a >> b >> c;
    if(a + b > c && a + c > b && b + c > a)
    if(a - b < c && a - c < b && b - c < a)
    {
    double p = (a + b + c) / 2;
    double s = sqrt(p * (p - a) * (p - b) * (p - c));
    printf("%.2f",s);
    }
    else
    printf("NO");
    else
    printf("NO");
    return 0;
    //题目打错了,应为 s = √ p(p - a)(p - b)(p - c)
    }

  • 0

    #include<iostream>
    #include<cmath>
    #include<iomanip>
    using namespace std;
    int main()
    {
    int a,b,c;double p;
    cin>>a>>b>>c;p=(a+b+c)/2.0;
    if(a+b>c&&a+c>b&&c+b>a)
    cout<<fixed<<setprecision(2)<<sqrt(p*(p-a)*(p-b)*(p-c));
    else
    cout<<"NO"<<endl;
    return 0;
    }

  • -1

    #include<iostream>
    #include<cmath>
    #include<iomanip>
    using namespace std;
    int main()
    {
    double p,a,b,c;
    cin>>a>>b>>c;p=(a+b+c)/2.0;
    if(a+b>c&&b+c>a&&c+a>b)
    cout<<fixed<<setprecision(2)<<sqrt(p*(p-a)*(p-b)*(p-c));
    else
    cout<<"NO";
    return 0;
    }

  • 1

信息

ID
1701
难度
6
分类
(无)
标签
递交数
400
已通过
120
通过率
30%
被复制
4
上传者