1 条题解

  • 0
    @ 2025-9-9 23:58:58

    C++ :

    #include<iostream>
    #include<math.h>
    #include<stdio.h>
    using namespace std;
      
    int main(){
        double a,b,c,p,s;
        cin>>a>>b>>c;
        if(a*a+b*b==c*c||a*a+c*c==b*b||c*c+b*b==a*a)
    	{
    		p=(a+b+c)/2;
    		s=sqrt(p*(p-a)*(p-b)*(p-c));
    		cout<<"s=";printf("%.2f\n",s);
    	}
        else cout<<"No!";
        return 0;
    }
    

    Pascal :

    var
    a,b,c,p,s:real;
     begin
       readln(a,b,c);
       if (a*a+b*b=c*c) or(a*a+c*c=b*b) or(b*b+c*c=a*a)  then
       begin p:=(a+b+c)/2; s:=sqrt(p*(p-a)*(p-b)*(p-c)); writeln('s=',s:0:2) ;end
       else writeln('No!');
    
     end.
    
    • 1

    信息

    ID
    2378
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者