1 条题解

  • 0
    @ 2025-4-7 21:41:57

    C :

    #include"stdio.h"
    #include"math.h"
    int main()
    {
    	//freopen("in.txt","r",stdin);
    	//freopen("out.txt","r+",stdout);
    	double s=0,a=0,b=0,h=0;
    	while(~scanf("%lf%lf%lf",&a,&b,&h))
    	{
    		s=4*a*b+2*b*sqrt(b*b/4+(h-a)*(h-a));
    		printf("%.3lf\n",s);
    	}
    	return 0;
    }
    

    C++ :

    #include <iostream>
    #include <cstdio>
    #include <cmath>
    using namespace std;
    
    int main() {
        double a, b, h;
        while(cin>>a>>b>>h) {
            h -= a;
            double s = a * b * 4 + 2 * b * sqrt(h*h + b*b/4.0);
            printf("%.3lf\n", s);
        }
        return 0;
    }
    
    
    • 1

    信息

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