HDU 4798 Skycity
来源:互联网 发布:北京公共图书馆网络 编辑:程序博客网 时间:2024/05/29 14:29
Skycity
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 355 Accepted Submission(s): 92
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?
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 5300 50 2000 500 10
Sample Output
149968.3082196020.459
Source
2013 Asia Changsha Regional Contest
思路:每层天花板的半径能根据高度算出来,然后的话,可以证明正n边行的n越大总面积越小,所以就是找最大的n是的单面的面积不低于S就行了,二分会超时,其实能直接算出来的,详情请看代码。
代码:
#include <iostream>#include <vector>#include <algorithm>#include <string.h>#include <cstring>#include <stdio.h>#include <cmath>#include <math.h>#define rep(i,a,b) for(int i=(a);i<(b);++i)#define rrep(i,b,a) for(int i = (b); i >= (a); --i)#define clr(a,x) memset(a,(x),sizeof(a))#define LL unsigned long long#define eps 1e-10using namespace std;const double PI = 4.0 * atan(1.0);double R,r,H,F,S;int dcmp(double a,double b){ if (a < b - eps) return -1; else if (a > b + eps) return 1; else return 0;}double h,rx;double MinnumunArea(){ double wmin = S / h; double arpha = atan2(wmin,rx * 2); int m = max(3,(int)(PI / arpha + 1e-12)); arpha = PI / m; //double w = rx * tan(arpha) * 2; //return w * h * m; return rx * tan(arpha) * 2.0 * h * m;}int main(){ #ifdef ACM freopen("in.txt", "r", stdin); #endif // ACM while (scanf("%lf%lf%lf%lf%lf",&R,&r,&H,&F,&S)==5) { h = H / F; double ans = 0; double ss = 0; for(LL i = 1; i <= F; ++i) { rx = R - (R-r) / F * i; ans += MinnumunArea(); } printf("%.3lf\n",ans); }}
0 0
- HDU 4798 Skycity
- HDU 4798 Skycity【几何】
- hdu 4798 Skycity(几何)
- HDU 4798 Skycity(计算几何)
- HDU 4798 Skycity【计算机几何】【阅读题】
- HDU 4793 Collision + HDU 4798 Skycity 简单几何
- Skycity
- zoj 3733 (hdu 4798) Skycity (2013 亚洲区域赛 长沙站 H)
- HDU 4798 Skycity (计算几何+推公式) 2013 Asia Changsha Regional Contest
- ZOJ3733 Skycity
- zoj 3733 Skycity
- zoj 3733 skycity
- ZOJ 3733 Skycity 数学
- zoj 3733 Skycity 长沙赛区
- UVALive 6618 Skycity(数学)
- ZJU 3733 长沙现场赛 H Skycity
- zoj 3733 Skycity 长沙现场赛H题
- hdu 4798
- Linux(CentOS)下安装 jdk 、tomcat
- centos 7开机默认进入文本模式
- 你应当知道的Java牛人 v2.0
- 织梦扣扣客服的仿制
- python代码性能优化技巧
- HDU 4798 Skycity
- Ubuntu安装xpenguins-2.2问题
- 查看字体的位置
- osgSim::SphereSegment分析
- 转:kerneler_ menuconfig过程详解
- sssss
- 为什么要使用SLF4J而不是Log4J
- linux popen和pclose
- 【大话NoSQL】——什么是NoSQL?