ZOJ3733_Skycity
这。。。水题。可惜坑了无数发。
显然对于当前的半径的园,多边形的边数越多,周长越短,面积也就越小。
一开始我是用二分去做的,事实证明也是可以的,只是我坑了。
其实没必要去用二分哦,这样来考虑这问题。
每次我都用最短允许的边与圆相切,看看这条边所占的角度有多大,这样就可以直接得出多少边形了。。。。(神坑吧)
接下来直接根据边数算出面积,就得答案了。 这才是真正的全场最水题啊。。。。。啊啊。。嗄。 吖a.a..。 阿。。
精度问题也都不用考虑。。。。。
#include <cstdio>
#include <cmath>
using namespace std;
const double full=*acos(-1.0); double R,r,H,S,ang,l,h,ans,cur,len,dr;
int n,F; int main()
{
while (scanf("%lf%lf%lf%d%lf",&R,&r,&H,&F,&S)!=EOF)
{
h=H/F,ans=,cur=r,dr=(R-r)/F,l=S/h;
while (F--)
{
ang=*atan(l/(*cur));
n=(int)(full/ang);
ans+=tan(full/(*n))*cur**n;
cur+=dr;
}
printf("%.3f\n",ans*h);
}
return ;
}
ZOJ3733_Skycity的更多相关文章
随机推荐
- Navigation - How to define the structure of the navigation tree via the NavigationItemAttribute
In the meantime, you should use the Model Editor to create such a navigation structure. There are se ...
- 为什么 Action/ViewController/ProperttyEditor不可见或不可用?
英文版:https://documentation.devexpress.com/eXpressAppFramework/112818/Concepts/Extend-Functionality/De ...
- jmeter☞工作区介绍(三)
基于jmeter4.0,jdk1.8 目录树:存放设计过程中使用的元件.执行过程中默认是从根节点开始顺序遍历元件.比如说HTTP请求的取样器就是元件,组件就是一个或多个元件的集合. 测试计划编辑区域: ...
- Java中的Union Types和Intersection Types
前言 Union Type和Intersection Type都是将多个类型结合起来的一个等价的"类型",它们并非是实际存在的类型. Union Type Union type(联 ...
- Git报错:Your branch is ahead of 'origin/master' by 1 commit
. commit之后,用git status,打印信息为: # On branch master # Your branch is ahead of 'origin/master' by 1 c ...
- cnblogs客户端配置说明
1. 下载地址 http://openlivewriter.org/ 2.安装 安装时设置好blog地址和账户.密码: 到这里基本上就算安装完成了.如果之前的自动配置没有成功,会出现一个界面让你配置b ...
- v-if、v-show 指令
HTML部分: <div id="app"> <button type="button" @click="flag=!flag&qu ...
- Netty源码分析第8章(高性能工具类FastThreadLocal和Recycler)---->第7节: 获取异线程释放的对象
Netty源码分析第八章: 高性能工具类FastThreadLocal和Recycler 第七节: 获取异线程释放的对象 上一小节分析了异线程回收对象, 原理是通过与stack关联的WeakOrder ...
- 高可用OpenStack(Queen版)集群-2.基础服务
参考文档: Install-guide:https://docs.openstack.org/install-guide/ OpenStack High Availability Guide:http ...
- Workbook对象的方法总结(一)
import openpyxlwb=openpyxl.Workbook()print('1.添加前所有工作簿的名称是:',wb.get_sheet_names())wb.create_sheet('F ...