地址: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

Problem Description
Nowadays, little haha got a problem from his teacher.His teacher wants to design a big logo for the campus with some circles tangent with each other. And now, here comes the problem. The teacher want to draw the logo on a big plane. You could see the example of the graph in the Figure1

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.

 
Input
The first line contains a integer t(1≤t≤1200), which means the number of the test cases. For each test case, the first line insist of two integers R1 and R2 separated by a space (1≤R≤100), which are the radius of the two big circles. You could assume that the two circles are internally tangented. The second line have a simple integer N (1≤N≤10 000 000), which is the number of small circles the teacher want to add.
 
Output
For each test case: 
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).
 
Sample Input
2
5 4
1
4 5
1
 
Sample Output
3.14159
3.14159
 
Source
 

思路:

  圆的反演。

  把俩个大圆的切点当做反演中心,可以得到下图:

  这样每个圆都变成同大小的圆了,那怎么计算半径呢?

这样一次算下去,直到后面的圆不影响答案时结束。

 #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的更多相关文章

  1. 「HDU6158」 The Designer(圆的反演)

    题目链接多校8-1009 HDU - 6158 The Designer 题意 T(<=1200)组,如图在半径R1.R2相内切的圆的差集位置依次绘制1,2,3,到n号圆,求面积之和(n< ...

  2. SharePoint 2013 create workflow by SharePoint Designer 2013

    这篇文章主要基于上一篇http://www.cnblogs.com/qindy/p/6242714.html的基础上,create a sample workflow by SharePoint De ...

  3. SharePoint 2013 Designer 入门教程

    SharePoint的使用中,SharePoint Designer是非常重要的工具,我们可以通过Designer设计页面.母版页,维护.管理站点,也可以定制列表表单.数据视图,设计工作流等等.下面总 ...

  4. O365(世纪互联)SharePoint 之使用Designer报错

    前言 在SharePoint Online中使用Designer报错,错误为:This Feature has been disabled by your administrator.找了好久发现原因 ...

  5. Altium Designer 的entry sheet ,offsheet和port作用(转载)

    1.图纸结构 图纸包括两种结构关系: 一种是层次式图纸,该连接关系是纵向的,也就是某一层次的图纸只能和相邻的上级或下级有关系: 另一种是扁平式图纸,该连接关系是横向的,任何两张图纸之间都可以建立信号连 ...

  6. Rehosting the Workflow Designer

    官方文档:https://msdn.microsoft.com/en-us/library/dd489451(v=vs.110).aspx The Windows Workflow Designer ...

  7. SharePoint 2013 Designer系列之自定义列表表单

    在SharePoint的使用中,默认的样式过于单调经常困扰着我们,其实,SharePoint使用Designer工具,可以很轻松解决这一问题,制作出各式各样漂亮的页面.下面,让我们简单介绍下这一过程. ...

  8. SharePoint 2013 Designer系列之数据视图

    在SharePoint使用中,数据展示是一块很重要的部分,很多时候我们会采用webpart的形式,但是有一些情况,我们不必使用开发,仅需使用Designer即可,下面让我简单介绍下数据视图的使用. 1 ...

  9. SharePoint 2013 工作流之使用Designer配置示例篇

    在SharePoint 2013中,支持SharePoint Designer 2013(以下简称SPD)配置简单的工作流,完成我们的业务需要.下面,我们就举一个小例子,实现SPD配置工作流. 1. ...

随机推荐

  1. Nginx(三)-- 配置文件之日志管理

    1.日志文件的默认存放位置 默认的日志文件存放位置在:nginx/logs/ 文件夹下,logs文件夹下有:access.log   error.log   nginx.pid 文件 2.nginx. ...

  2. C++预处理和头文件保护符

    一预处理 1.常见的预处理功能 预处理器的主要作用就是把通过预处理的内建功能对一个资源进行等价替换,最常见的预处理有:文件包含,条件编译.布局控制和宏替换4种.文件包含:#include 是一种最为常 ...

  3. UIBarButtonItem

    1.UINavigationController导航控制器如何使用 UINavigationController可以翻译为导航控制器,在IOS里经常用到. 我们看看它的如何使用: 下面的图显示了导航控 ...

  4. mysql的介绍和安装

    本节内容 1.数据库介绍 2.mysql管理 3.mysql数据类型 4.常用mysql命令 创建数据库 外键 增删改查表 5.事务 6.索引 1.数据库介绍 什么是数据库? 数据库(Database ...

  5. MQTT的学习研究(四)moquette-mqtt 的使用之mqtt Blocking API客户端订阅并接收主题信息

    在上面两篇关于mqtt的broker的启动和mqtt的服务端发布主题信息之后,我们客户端需要订阅相关的信息并接收相关的主题信息. package com.etrip.mqtt; import java ...

  6. 【linux系列】vi模式下查找和替换

    一.查找 1.查找命令 /pattern<Enter> :向下查找pattern匹配字符串 ?pattern<Enter> :向上查找匹配字符串 在使用了查找命令之后,使用如下 ...

  7. datatables如何让某个列中的值居中显示?

    https://datatables.net/reference/option/columns.className 通过 columns.className 属性设置: 例如: js: columns ...

  8. spfile与pfile

    SYS@ora11g>show parameter spfile NAME TYPE------------------------------------ ------------------ ...

  9. 【ES6】001---module模块------【巷子】

    001.前言 什么是模块化开发?   为了提高代码的复用度,开发人员会按照功能把大量的js代码分成若干文件,这样在多个页面就可以使用同一个文件了.,下面是某个网站的js引用情况 怎么会有这么多js文件 ...

  10. 【数组】—冒泡排序&&选择排序---【巷子】

    /* 什么是冒泡排序:从头到尾比较相邻的两个数的大小,如果符合条件则进行比较 [注]:从小到大进行排序 假设有一个数组 var arr = [9,8,7,6,5,4]; 我们想要进行这个数组进行排序那 ...