zoukankan      html  css  js  c++  java
  • 51nod B君的圆锥(数学)

    题目链接:

    B君的圆锥

    基准时间限制:1 秒 空间限制:131072 KB 
    B君要用一个表面积为S的圆锥将白山云包起来。
     
    B君希望包住的白山云体积尽量大,B君想知道体积最大可以是多少。
     
    注意圆锥的表面积包括底面和侧面。
    Input
    一行一个整数,表示表面积S。(1 <= S <= 10^9)
    Output
    一行一个实数,表示体积。
    Input示例
    8
    Output示例
    1.504506


    题意:

    思路:

    找打圆锥体积与表面积的关系,再找出体积的最大值就好了,可以发现当圆锥的底面积PI*r^2=S/4,时可以使体积取到最大值;


    AC代码:

    //#include <bits/stdc++.h>
    #include <iostream>
    #include <queue>
    #include <cmath>
    #include <map>
    #include <cstring>
    #include <algorithm>
    #include <cstdio>
    using namespace std;
    #define Riep(n) for(int i=1;i<=n;i++)
    #define Riop(n) for(int i=0;i<n;i++)
    #define Rjep(n) for(int j=1;j<=n;j++)
    #define Rjop(n) for(int j=0;j<n;j++)
    #define mst(ss,b) memset(ss,b,sizeof(ss));
    typedef long long LL;
    const LL mod=1e9+7;
    const double PI=acos(-1.0);
    const int inf=0x3f3f3f3f;
    const int N=1e5+25;
    
    int main()
    {
            double s;
           while(scanf("%lf",&s)!=EOF)
           {
           printf("%.6lf
    ",s*sqrt(s/(8*PI))/3);
           }
        return 0;
    }
  • 相关阅读:
    正则表达式(转)
    Collections中的shuffle()方法
    Fermat定理
    哈希算法(转)
    Hungarian method (匈牙利算法)----解决指派问题(转)
    蒙塔卡洛模拟
    线程的礼让
    线程间的沟通
    安装rlwrap
    yum切到光盘源
  • 原文地址:https://www.cnblogs.com/zhangchengc919/p/5515479.html
Copyright © 2011-2022 走看看