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. [WEB安全]代码/命令执行总结

    0x01 代码执行 1.1 概念 远程代码执行实际上是调用服务器网站代码进行执行. 1.2 常见执行方法 eval eval():将字符串当做函数进行执行(需要传入一个完整的语句) demo: < ...

  2. Invalid Component definition:header

    主要是header不是字符串,而是变量

  3. formidable处理提交的表单或图片文件的简单介绍

    一般来说,客户端向服务端提交数据有GET和POST这两种方式,在之前的文章node.js当中的http模块与url模块的简单介绍当中我们可以知道通过req.url与url模块的配合处理可以快速得到客户 ...

  4. Apache Flink - 作业和调度

    Scheduling: Flink中的执行资源通过任务槽(Task Slots)定义.每个TaskManager都有一个或多个任务槽,每个槽都可以运行一个并行任务管道(pipeline).管道由多个连 ...

  5. go无缓冲通道

    package main import ( "fmt" "math/rand" "sync" "time" ) //wg ...

  6. 可视化图表库--goJS

    GoJS是Northwoods Software的产品.Northwoods Software创立于1995年,专注于交互图控件和类库.旗下四款产品: GoJS:用于在HTML上创建交互图的纯java ...

  7. [GitHub]纪华裕的GitHub收藏

    由于GitHub的star没有分类功能在此写下我的收藏. JS nodenodejs的仓库 puppeteer一个用户测试的无头浏览器 moment日期操作库,包括格式化等

  8. Fiddler is not capturing web request from Firefox

    Fiddler is not capturing web request from Firefox You can also get the FiddlerHook plug in for Firef ...

  9. C# 怎么生成DLL文件(转)

    有两种方法:     但是一般这个使用     打开VS2008,依次点击:菜单->文件->新建项目->项目类型visual C#(这里假设为该项目所取的名字是DllBuild)-& ...

  10. java中 int、char、long各占多少字节数

    所谓的占用字节数 就是申请内存的时候所占的空间大小 byte    1字节 最小值是 -128(-2^7):    最大值是 127(2^7-1): boolean    至少1字节 这种类型只作为一 ...