博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU 4798 Skycity
阅读量:7002 次
发布时间:2019-06-27

本文共 2942 字,大约阅读时间需要 9 分钟。

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 
#include
#include
#include
#include
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\n",ans); } return 0;}

 

转载于:https://www.cnblogs.com/hlmark/p/4001142.html

你可能感兴趣的文章
Codeforces Round #268 (Div. 2) c
查看>>
如果后台的Activity由于某原因被系统回收了,如何在被系统回收之前保存当前状态?...
查看>>
postgresql 自动备份
查看>>
读写文件之日志文件
查看>>
win7 远程桌面凭证不工作
查看>>
cookies,sessionStorage 和 localStorage 的区别
查看>>
android中Tab设计中:tab中的listview最下面一部分被tab遮盖的解决
查看>>
CentOS下编译php时的一些典型错误及解决办法.
查看>>
Hg Mercurial版本管理介绍
查看>>
redis
查看>>
开源项目学习方法
查看>>
block的使用
查看>>
使用Toolbar自定义布局的时候左边右边总有一点空间无法使用
查看>>
Photoshop 常用快捷键
查看>>
外观模式
查看>>
Extjs 4 grid修改某一行style
查看>>
background-position设置无效问题解决
查看>>
对称加密算法-DES
查看>>
Android BroadcastReceiver
查看>>
我的友情链接
查看>>