zoukankan      html  css  js  c++  java
  • HDU 4798 Skycity

    Skycity

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
    Total Submission(s): 269    Accepted Submission(s): 63


    Problem Description
    The world's new tallest building is going to be built in Changsha, which will be called as "Skycity". The Skycity is going to be built as a circular truncated cone, radius of its bottom is marked as R, and radius of its top is marked as r, height of the building is marked as H, and there will be F floors with exact the same height in the whole building.
    After construction of the building's skeleton, the construction team is going to construct the curtain wall using thousands of glass panes. The curtain wall is installed in each floor. When installing the curtain wall in a floor, first the construction team will measure the radius r' of the ceiling, then they will install the glass curtain wall as a regular prism which can exactly contain the ceiling circle. When constructing the glass curtain wall, all the glass pane has a minimum area requirement S, and amount of glass usage should be as little as possible.

    As all the glass has exact the same thickness, so we can calculate the consumption of each glass pane as its area. Could you calculate the minimum total glass consumption?
     
    Input
    There will be multiple test cases. In each test case, there will be 5 integers R, r (10 ≤ r < R ≤ 10000), H (100 ≤ H ≤ 10000), F (10 ≤ F ≤ 1000) and S (1 ≤ S <× r × H ÷ F) in one line.
     
    Output
    For each test case, please output the minimum total glass consumption, an absolute error not more than 1e-3 is acceptable.
     
    Sample Input
    50 10 800 120 5 300 50 2000 500 10
     
    Sample Output
    149968.308
    2196020.459
     
    Source
     

    这条是2013年长沙的题目

    二分的题目就是卡姿势,同浮点误差~

    二分姿势稍有不当就WA  

    求第 i 层的圆的半径一层层的加又WA , 要直接用公式  ri = add * i + r ;

    #include <iostream>
    #include <string.h>
    #include <stdio.h>
    #include <algorithm>
    #include <cmath>
    using namespace std;
    const double PI = acos(-1.0);
    const double eps = 1e-8;
    inline double getlen(int n,double r)
    {
        return 2.0 * r * tan( PI / n );
    }
    int main()
    {
        ios::sync_with_stdio(0);
    
        #ifdef LOCAL
            freopen("in.txt","r",stdin);
        #endif // LOCAL
    
        double R,r,H,F,S;
        while( cin >> R >> r >> H >> F >> S ){
            double h = H / F , ans = 0 , add = ( R - r ) / F , ri  ;
    
            for( int i = 0 ; i < F ; i++ )
            {
                ri = add * i  + r ;
                int ll = 3 ,rr = 100000 ;
                double area ;
                int num;
                while( ll <= rr )
                {
                    int mm = ( ll + rr ) >> 1;
                    double tmp = getlen( mm , ri ) * h;
                    if( S + eps < tmp ){
                        area = tmp , num = mm;
                        ll = mm + 1;
                    }
                    else{
                        rr = mm - 1;
                  }
            } ans
    += num * area; } printf("%.3lf ",ans); } return 0; }
    only strive for your goal , can you make your dream come true ?
  • 相关阅读:
    CodeForces 731A Night at the Museum
    nyoj914 Yougth的最大化
    addEventListener或attachEvent都可以用bind代替
    答疑
    js判断是pc还是手机
    js实现xml转json和json转xml
    js实现xml转json
    margin重叠的解决办法
    去除移动端按钮点击时的阴影和rem标签垂直居中
    关于fiddler https 客户端 抓包配置
  • 原文地址:https://www.cnblogs.com/hlmark/p/4001142.html
Copyright © 2011-2022 走看看