• 1629 B君的圆锥


    B君要用一个表面积为S的圆锥将白山云包起来。

     
    B君希望包住的白山云体积尽量大,B君想知道体积最大可以是多少。
     
    注意圆锥的表面积包括底面和侧面。
    Input
    一行一个整数,表示表面积S。(1 <= S <= 10^9)
    Output
    一行一个实数,表示体积。
    Input示例
    8
    Output示例
    1.504506
    /*
        推公式 
            设圆锥底面半径为r ,高为h,则母线为 sqrt(r*r+h*h);
               进而得到面积公式
                S=pi*l*r+pi*r*r
            由这个方程可以解出r*r和h的关系
            带入体积公式
                pi*r*r*h/3 得到公式
    
                h*S*S/(3*h*h+6*S);
               =S*S/(3*pi*h+6*S/h)
               这是个对角函数 在h取 sqrt(2*pi*S)的时候取最大值
               带入得到
                   s*s/(6*sqrt(2*pi*S))    
     */
    #include <bits/stdc++.h>
    
    #define pi acos(-1)
    
    using namespace std;
    
    double s;
    
    int main(){
        scanf("%lf",&s);
        printf("%.6lf
    ",s*s/(6*sqrt(2*pi*s)));        
        return 0;
    }
  • 相关阅读:
    递推数列
    大数阶乘
    成绩排序
    DevC++ return 1 exit status
    POJ 1061 青蛙的约会
    ZOJ 2750 Idiomatic Phrases Game
    nyoj 545 Metric Matrice
    nyoj 308 Substring
    nyoj 515完全覆盖 II
    nyoj 1248 海岛争霸
  • 原文地址:https://www.cnblogs.com/wuwangchuxin0924/p/7858119.html
Copyright © 2020-2023  润新知