HDU 4798 - Skycity
告诉你一幢楼的高度,楼的层数,每层一样高。
每一层的底边是一个圆,下一层的玻璃一定要包括进上一层的底边。
每层玻璃铺成棱柱形,玻璃有最小面积限制。
问你这层楼最小的总玻璃数是多少。
求出每层最小的玻璃块数,然后直接计算即可。
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
const double PI=*atan();
int F;
double R,r,H,s;
double r1,r0,h,ans;
double cal(int x,double rr)
{
return 2.0*rr*tan(PI/x)*h;
}
double div2(double rr)
{
int l=,r=1e6,mid;
while(l<=r)
{
mid=(l+r)>>;
if(cal(mid,rr)>s-1e-) l=mid+;
else r=mid-;
}
return cal(l-,rr)*(l-);
}
int main()
{
while(~scanf("%lf%lf%lf%d%lf",&R,&r,&H,&F,&s))
{
r0=(R-r)*1.0/F;
h=H*1.0/F;
ans=;
for(int i=;i<F;i++)
{
ans+=div2(r+r0*i);
}
printf("%.3f\n",ans);
}
}
HDU 4798 - Skycity的更多相关文章
- 2013 ACM区域赛长沙 H zoj 3733 (hdu 4798) Skycity
题意:一个圆台,底面和顶面半径分别为R,r,然后高度为H,一共F层,每层高度一样,然后要在每层的天花板上贴方格玻璃,方格玻璃要满足以下几个条件: 方格玻璃面积不能小于S,且方格玻璃要围成一个正多边形, ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
- HDU 1796How many integers can you find(容斥原理)
How many integers can you find Time Limit:5000MS Memory Limit:32768KB 64bit IO Format:%I64d ...
- hdu 4481 Time travel(高斯求期望)(转)
(转)http://blog.csdn.net/u013081425/article/details/39240021 http://acm.hdu.edu.cn/showproblem.php?pi ...
- HDU 3791二叉搜索树解题(解题报告)
1.题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=3791 2.参考解题 http://blog.csdn.net/u013447865/articl ...
随机推荐
- js静态方法
1.ajax() 方法是属于“函数”本身的,和返回的对象没有关系 2.bark药调用,必须药new Hashiqi()得到对象,且由返回对象才能调用 3.ajax()方法药调用,不需要new对象,直接 ...
- oracle生成随机数
UPDATE busi_chance_info t SET t.exp_amount = (SELECT floor(dbms_random.value(1, 10000000)) ...
- contentSize、contentInset和contentOffset
contentSize.contentInset和contentOffset 是 scrollView三个基本的属性. contentSize: The size of the content vie ...
- UIWindow & UIWindowLevel详解
一.UIWindow是一种特殊的UIView,通常在一个程序中只会有一个UIWindow,但可以手动创建多个UIWindow,同时加到程序里面.UIWindow在程序中主要起到三个作用: 1.作为容器 ...
- .c_str()/atoi()/
1. c_str是把string类型强制转换为const string 2. atpi(): Convert string to integer --Parses the C-string str i ...
- CI(CodeIgniter)学习第二讲
一.CI的文件结构: 了解CI的文件结构可以帮助我们快速的对CI框架有一个整体的认识,就好像我们去了一个陌生的城市一样,对你来讲周围的一切都是陌生和未知的,要想快速的了解这座城市,你可以买一张这座城市 ...
- php error_log 详解
定义和用法 error_log() 函数向服务器错误记录.文件或远程目标发送一个错误. 成功,返回 true,否则返回 false. error_log(error,type,destination, ...
- Ubuntu安装字体的方法
基本步骤如下: 1. 将要安装的字体放在一个文件夹下,以/home/UsrName/Download/Font为例 2.在终端中输入 sudo cp -r /home/UsrName/Download ...
- jQuery之动画效果
1.show()显示效果 语法:show(speed,callback) Number/String,Function speend为动画执行时间,单位为毫秒.也可以为slow"," ...
- ubuntu下编译源码级QT
注意必须好好看官方文档: http://qt-project.org/doc/qt-5/linux.html 包括编译Qt库依赖的包等等. 编译过程中发现以下错误: All the OpenGL fu ...