The Queen’s Super-circular Patio

题目描述

The queen wishes to build a patio paved with of a circular center stone surrounded by circular rings of circular stones. All the stones in a ring will be the same size with the same number of stones in each ring. The stones in the innermost ring will be placed touching (tangent to) the adjacent stones in the
ring and the central stone. The stones in the other rings will touch the two adjacent stones in the next inner ring and their neighbors in the same ring. The fi gures below depict a patio with one ring of three stones and a patio with 5 rings of 11 stones. The patio is to be surrounded by a fence that goes around the outermost stones and straight between them (the heavier line in the fi gures).

The queen does not yet know how many stones there will be in each circle nor how many circles of stones there will be. To be prepared for whatever she decides, write a program to calculate the sizes of the stones in each circle and the length of the surrounding fence. The radius of the central stone is to be one queenly foot.

输入

The first line of input contains a single integer P, (1 ≤ P ≤ 1000), which is the number of data sets that follow. Each data set should be processed identically and independently.
Each data set consists of a single line of input. It contains the data set number, K, the number, N (3 ≤ N ≤ 20), of stones in each circle and the number, M (1 ≤ M ≤ 15), of circles of stones around the central stone.

输出

For each data set there is a single line of output. It contains the data set number, K, followed by a single space which is then followed by the radius (in queenly feet) of the stones in the outermost ring (to 3 decimal places) which is followed by a single space which is then followed by the length (in queenly feet) of the fence (to 3 decimal places).

样例输入

3
1 3 1
2 7 3
3 11 5

样例输出

1 6.464 79.400
2 3.834 77.760
3 2.916 82.481

【参考博客】

https://www.cnblogs.com/starve/p/11164586.html

【队友代码】

 #include<bits/stdc++.h>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <cstring>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <stdlib.h>
#include <list>
#include <map>
#include <utility>
#include <set>
#include <bitset>
#include <vector>
#define pi acos(-1.0)
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fLL
#define ms(a,b) memset(a,b,sizeof(a))
typedef long long ll;
const int maxn=1e4+;
double r[];
int main()
{
int t;
int x;
int k,m;
scanf("%d",&t);
while(t--)
{
memset(r,,sizeof r);
scanf("%d",&x);
printf("%d ",x);
scanf("%d%d",&k,&m);
double s=pi/k;
r[]=1.0*sin(s)/(1.0-sin(s)); double b=-(2.0*((+r[])/tan(s)+r[]));
double a=(1.0/(tan(s)*tan(s)));
double c=*r[]+;
r[]=(-b+sqrt(b*b-4.0*a*c))/(2.0*a); for(int i=;i<=m+;i++)r[i]=(r[i-]*r[i-])*1.0/r[i-]*1.0;
double ans=(*k+*pi)*r[m+];
printf("%.3f %.3f\n",r[m+],ans); }
return ;
}

【计算几何】The Queen’s Super-circular Patio的更多相关文章

  1. POJ 2069 Super Star(计算几何の最小球包含+模拟退火)

    Description During a voyage of the starship Hakodate-maru (see Problem 1406), researchers found stra ...

  2. POJ2546 Circular Area(计算几何)

                                                                                Circular Area            ...

  3. The Queen's Super-circular Patio 求栏杆

    Input The first line of input contains a single integer P, (1 ≤ P ≤ 1000), which is the number of da ...

  4. 用开源项目circular progress button实现有进度条的Button

    circular progress button可以让button实现进度条,效果和动画都做的很赞,只是有点小bug.需要注意的是按钮上的文字不能太大,否则会出现错位. 项目的地址:https://g ...

  5. 子类继承父类时JVM报出Error:Implicit super constructor People() is undefined for default constructor. Must define an explicit constructor

    当子类继承父类的时候,若父类没有定义带参的构造方法,则子类可以继承父类的默认构造方法 当父类中定义了带参的构造方法,子类必须显式的调用父类的构造方法 若此时,子类还想调用父类的默认构造方法,必须在父类 ...

  6. 如何在Spring MVC Test中避免”Circular view path” 异常

    1. 问题的现象 比如在webConfig中定义了一个viewResolver public class WebConfig extends WebMvcConfigurerAdapter { //配 ...

  7. [LeetCode] Super Ugly Number 超级丑陋数

    Write a program to find the nth super ugly number. Super ugly numbers are positive numbers whose all ...

  8. Maven Super POM

    Maven super POM defines some properties. Three ways to find it ${M2_HOME}/lib/maven-model-builder-3. ...

  9. java基础 super 子类调用父类

    如果希望在子类中,去调用父类的构造方法,要求在子类的构造函数调用 example如下: package test; /* * 如果希望在子类中,去调用父类的构造方法,要求在子类的构造函数调用 * */ ...

随机推荐

  1. 学习OpenCV双目测距原理及常见问题解答

    学习OpenCV双目测距原理及常见问题解答 转自博客:https://blog.csdn.net/angle_cal/article/details/50800775 一. 整体思路和问题转化.  图 ...

  2. 安装virtual box

    将安装包放在app目录下: 进入安装目录,输入sudo gdebi 安装包名 安装完后,可以在搜索框中搜索:virtual 会出现安装好的虚拟机盒子.

  3. Bsgs模板

    模板最主要的是自己看得舒服,不会给自己留隐患,调起来比较简单,板子有得是,最主要的是改造出适合你的那一套.                  ——mzz #include<bits/stdc++ ...

  4. エンジニア死滅シタ世界之学べない学校 [MISSION LEVEL: C]-Python3

    答案 # coding: utf-8 # 自分の得意な言語で # Let's チャレンジ!! N=input() w_a=0 w_b=0 gpc_dict={ "gg":0,&qu ...

  5. Linux 系统配置IPv6

    1.自动获取IPV6地址 1)修改/etc/sysconfig/network文件,修改如下字段,不存在则手动添加,部分系统默认是开启的NETWORKING_IPV6=yes 2)修改/etc/sys ...

  6. qt 添加本程序的注册表项

    QStringcmd; cmd.clear(); QStringapplication_path=QCoreApplication::applicationFilePath();//带文件扩展名的全路 ...

  7. 激活函数,Batch Normalization和Dropout

    神经网络中还有一些激活函数,池化函数,正则化和归一化函数等.需要详细看看,啃一啃吧.. 1. 激活函数 1.1 激活函数作用 在生物的神经传导中,神经元接受多个神经的输入电位,当电位超过一定值时,该神 ...

  8. 关于路由跟踪指令---traceroute

    我们都用过ping命令来检查主机与目标地址是否连通,自己的主机与目标地址的通讯包通讯速率,所谓的通讯包也就是那些什么TCP/IP,UDP包. 原理:https://www.cnblogs.com/be ...

  9. CDH 安装的博客地址记录

    1. 集群环境配置 https://www.cnblogs.com/yinzhengjie/articles/11019333.html 2. 二进制方法安装 https://www.cnblogs. ...

  10. Spring为什么@Autowired注入的是接口

    1.Spring怎么知道注入哪个实现? As long as there is only a single implementation of the interface and that imple ...