hdu6158 The Designer
地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=6158
题目:
The Designer
Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1381 Accepted Submission(s): 289
At first, haha's teacher gives him two big circles, which are tangent with each other. And, then, he wants to add more small circles in the area where is outside of the small circle, but on the other hand, inside the bigger one (you may understand this easily if you look carefully at the Figure1.
Each small circles are added by the following principles.
* you should add the small circles in the order like Figure1.
* every time you add a small circle, you should make sure that it is tangented with the other circles (2 or 3 circles) like Figure1.
The teacher wants to know the total amount of pigment he would use when he creates his master piece.haha doesn't know how to answer the question, so he comes to you.
Task
The teacher would give you the number of small circles he want to add in the figure. You are supposed to write a program to calculate the total area of all the small circles.
Contains a number in a single line, which shows the total area of the small circles. You should out put your answer with exactly 5 digits after the decimal point (NO SPJ).
5 4
1
4 5
1
3.14159
思路:
圆的反演。
把俩个大圆的切点当做反演中心,可以得到下图:
这样每个圆都变成同大小的圆了,那怎么计算半径呢?
这样一次算下去,直到后面的圆不影响答案时结束。
#include <bits/stdc++.h> using namespace std; #define MP make_pair
#define PB push_back
typedef long long LL;
typedef pair<int,int> PII;
const double eps=1e-;
const double PI=acos(-1.0);
const int K=1e6+;
const int mod=1e9+; int main(void)
{
int t,n;cin>>t;
while(t--)
{
double lx,rx,x,y,d,r,nr,s,ans=;
scanf("%lf%lf%d",&lx,&rx,&n);
lx=0.5/lx,rx=0.5/rx;
if(lx>rx) swap(lx,rx);
x=(lx+rx)/2.0;
r=(rx-lx)/2.0;
for(int i=;i<=n;i++)
{
y=(i/)*r*;
d=sqrt(x*x+y*y);
nr=0.5*(1.0/(d-r)-1.0/(d+r));
s=nr*nr*PI;
if(s<1e-) break;
ans+=s;
}
printf("%.5f\n",ans);
} return ;
}
hdu6158 The Designer的更多相关文章
- 「HDU6158」 The Designer(圆的反演)
题目链接多校8-1009 HDU - 6158 The Designer 题意 T(<=1200)组,如图在半径R1.R2相内切的圆的差集位置依次绘制1,2,3,到n号圆,求面积之和(n< ...
- SharePoint 2013 create workflow by SharePoint Designer 2013
这篇文章主要基于上一篇http://www.cnblogs.com/qindy/p/6242714.html的基础上,create a sample workflow by SharePoint De ...
- SharePoint 2013 Designer 入门教程
SharePoint的使用中,SharePoint Designer是非常重要的工具,我们可以通过Designer设计页面.母版页,维护.管理站点,也可以定制列表表单.数据视图,设计工作流等等.下面总 ...
- O365(世纪互联)SharePoint 之使用Designer报错
前言 在SharePoint Online中使用Designer报错,错误为:This Feature has been disabled by your administrator.找了好久发现原因 ...
- Altium Designer 的entry sheet ,offsheet和port作用(转载)
1.图纸结构 图纸包括两种结构关系: 一种是层次式图纸,该连接关系是纵向的,也就是某一层次的图纸只能和相邻的上级或下级有关系: 另一种是扁平式图纸,该连接关系是横向的,任何两张图纸之间都可以建立信号连 ...
- Rehosting the Workflow Designer
官方文档:https://msdn.microsoft.com/en-us/library/dd489451(v=vs.110).aspx The Windows Workflow Designer ...
- SharePoint 2013 Designer系列之自定义列表表单
在SharePoint的使用中,默认的样式过于单调经常困扰着我们,其实,SharePoint使用Designer工具,可以很轻松解决这一问题,制作出各式各样漂亮的页面.下面,让我们简单介绍下这一过程. ...
- SharePoint 2013 Designer系列之数据视图
在SharePoint使用中,数据展示是一块很重要的部分,很多时候我们会采用webpart的形式,但是有一些情况,我们不必使用开发,仅需使用Designer即可,下面让我简单介绍下数据视图的使用. 1 ...
- SharePoint 2013 工作流之使用Designer配置示例篇
在SharePoint 2013中,支持SharePoint Designer 2013(以下简称SPD)配置简单的工作流,完成我们的业务需要.下面,我们就举一个小例子,实现SPD配置工作流. 1. ...
随机推荐
- PHP代码审计 -1.SQL注入总结
0x01 背景 最近在学习PHP代码审计,这里做一个SQL注入总结,是对自己学习知识的总结,也是为自己学习的笔记,方便自己反复翻阅. 0x02 PHP代码审计-SQL注入 挖掘SQL ...
- 管理开机启动:systemd
一.CentOS7 systemd 介绍 在 CentOS7 中,使用 systemd 来管理其他服务是否开机启动,systemctl 是 systemd 服务的命令行工具 [root@localho ...
- <转>SVM实现之SMO算法
转自http://blog.csdn.net/zouxy09/article/details/17292011 终于到SVM的实现部分了.那么神奇和有效的东西还得回归到实现才可以展示其强大的功力.SV ...
- Delphi 单元
单元(unit)是组成Pascal程序的单独的源代码模块,单元有函数和过程组成,这些函数和过程能被主程序调用.一个单元至少要有unit语句,interface,和implementation三部分,也 ...
- struts2基础---->自定义拦截器
这一章,我们开始struts2中拦截器的学习. 自定义拦截器
- <a>标签实现链接和锚点的区别
如果是实现链接,a标签中必须有href属性,并且属性值是合法的url 如果实现锚点,a标签中必须有name属性,当点击该标签时,会跳转到id同该标签的name值相同的元素处.
- javascript构造函数及原型对象
/** @ javascript中没有类的概念,所以基在对象创建方面与面向对象语言有所不同* @ 对象创建的常用方法及各自的局限性* @ 使用Object或对象字面量创建对象* @ 工厂模式创建对象* ...
- HTML的特殊字符-图标对应表
本文摘自:http://www.cnblogs.com/web-d/archive/2010/04/16/1713298.html HTML特殊字符编码大全:往网页中输入特殊字符,需在html代码 ...
- 配置项目使用weblogic的JNDI数据源
项目结构构:Spring Framework + SpirngMVC + SpringData JPA + Maven 1.在weblogic的控制台界面中配置数据源(假定我们配置的数据源的名称为da ...
- App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure.
[摘要: App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecur ...