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.== 和 === 的区别 ===要求类型也相等 "5"==5 = ture "5"===5 = false ...
- JavaScript当中的eval函数
eval函数 eval函数接收一个由JavaScript语句组成的字符串,并且返回字符串中最后一条语句的返回值,如果最后一条语句没有返回值,那么eval函数返回undefined.如果传递给eval函 ...
- php常用的header头
<?php /** * php常用的header头设置... */ header('HTTP/1.1 200 OK'); // ok 正常访问 header('HTTP/1.1 404 Not ...
- wordpress教程之修改上传文件大小限制
1. 修改apache配置文件 php.ini upload_max_filesize = 64M post_max_size = 64M max_execution_time = 300 //上 ...
- 添加事件监听兼容IE6-8
IE8一下浏览器不支持addEventListener,用attachEvent取而代之,但是在时间类型前面要加上’on‘,例如click时间在attachEvent中要写成onclick. var ...
- POP3、SMTP、IMAP和Exchange都是个什么玩意?
很多时候一直对POP3.SMTP.IMAP和Exchange等迷迷糊糊的.下面就整理说明一下: 当前常用的电子邮件协议有SMTP.POP3.IMAP4,它们都隶属于TCP/IP协议簇,默认状态下,分别 ...
- Linux命令之xargs的分析及隐患
写一个main.c: #include <stdio.h> int main(){ printf("foo"); printf("bar"); re ...
- mac安装GNU命令行工具
mac安装GNU命令行工具 2.添加的repo tap home/dupes brew install coreutils binutils diffutils ed -- ...
- Grunt制作个人博客简集
原文:http://www.gbtags.com/gb/share/4916.htm GitHub地址:http://yansm.github.io/fromone/
- 【LeetCode练习题】Maximum Depth of Binary Tree
Maximum Depth of Binary Tree Given a binary tree, find its maximum depth. The maximum depth is the n ...