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. ROUND() 函数

    ROUND() 函数 ROUND 函数用于把数值字段舍入为指定的小数位数. SQL ROUND() 语法 SELECT ROUND(column_name,decimals) FROM table_n ...

  2. C语言结构体笔记

    typedef给结构起别名 可以是匿名结构或者普通的结构,方便后面使用. #include<stdio.h> typedef struct{ //匿名结构 float tank_capac ...

  3. Django中使用Bootstrap----带view.py视图函数(也就是项目下的脚本文件)

    一.Django中使用Bootstrap 1.首先建立工程,建立工程请参照:https://www.cnblogs.com/effortsing/p/10394511.html 2.在Firstdja ...

  4. PostgreSQL学习笔记——事务

    事务时需要在同一处理单元中执行的一系列更新处理的集合.通过使用事务,可以对数据库中的数据更新处理的提交和取消进行管理. 事务处理的终止指令包括COMMIT(提交处理)和ROLLBACK(取消处理)两种 ...

  5. iOS——使用FMDB进行数据库操作(转载)

    iOS 使用FMDB进行数据库操作 https://github.com/ccgus/fmdb [摘要]本文介绍iOS 使用FMDB进行数据库操作,并提供详细的示例代码供参考. FMDB 使用方法 A ...

  6. iOS-UIStoryboard和UIResponder

    6.17 UIStoryboard //获取someboard中InitialViewController UIStoryboard *story = [UIStoryboard storyboard ...

  7. Jrebel激活方法

    参考 https://www.yanjiayu.cn/posts/3eecb801.html https://gitee.com/gsls200808/JrebelLicenseServerforJa ...

  8. 人工智能_2_特征处理.py

    # 特征处理 # 特征预处理:通过统计方法将数据转换为算法需要的数据 # 数值型数据:标准缩放 # 规依法,标准化(常用,适用于当前大数据),缺失值处理(删除,填补中位数平均数,通常按照列填补) # ...

  9. in-place数据交换

    实现in-place的数据交换 声明:引用请注明出处http://blog.csdn.net/lg1259156776/ 经典的排序问题 问题描述 一个数组中包含两个已经排好序的子数组,设计一个in- ...

  10. TCP使用

    TCP使用注意事项总结   目录 发送或者接受数据过程中对端可能发生的情况汇总 本端TCP发送数据时对端进程已经崩溃 本端TCP发送数据时对端主机已经崩溃 本端TCP发送数据时对端主机已经关机 某个连 ...