HDU 4798 计算几何 解题报告

Skycity

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

[解题报告]
尽管题面很复杂,图给的很高端,但这依然掩盖不了它是个大水题的事实。。。

代码如下:

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;

const double PI=4*atan(1.0);

int F;
double R,L,H,S;

double solve(double r,double h) 
{
    int n=PI/atan(S/2/h/r);
    double rad=PI/n;
    return 2*r*n*tan(PI/n);
}
int main () 
{
    while(scanf("%lf%lf%lf%d%lf",&R,&L,&H,&F,&S)==5) 
    {
        double ans=0,r=(R-L)/F,h=H/F;
        for (int i=0;i<F;i++)
            ans+=solve(L+r*i,h)*h;
        printf("%.3lf\n",ans);
    }
    return 0;
}

让我看到你们的双手

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值