1 solutions

  • 0
    @ 2025-11-5 15:42:38

    C++ :

    #include<iostream>
    #include<cmath>
    #include<cstdio>
    #define S(a,b,c)	(a+b+c)/2
    #define AREA(a,b,c)	sqrt(S(a,b,c)*(S(a,b,c)-a)*(S(a,b,c)-b)*(S(a,b,c)-c))
    using namespace std;
    int main()
    {
    	double a,b,c;
    	cin>>a>>b>>c;
    	printf("%.3lf\n",AREA(a,b,c));
    	return 0;
    }
    

    Pascal :

    var
        a,b,c,p,s:real;
    begin
        read(a,b,c);
        if ((a+b)>c) and ((b+c)>a) and ((a+c)>b) then begin
            p:=(a+b+c)/2;
            s:=sqrt(p*(p-a)*(p-b)*(p-c));
            write(s:0:3);
        end;
    end.
    
    • 1

    C语言程序设计教程(第三版)课后习题9.3

    Information

    ID
    17074
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    (None)
    # Submissions
    0
    Accepted
    0
    Uploaded By