【计算几何】The Queen’s Super-circular Patio
The Queen’s Super-circular Patio
题目描述
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.
输入
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.
输出
样例输入
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的更多相关文章
- POJ 2069 Super Star(计算几何の最小球包含+模拟退火)
Description During a voyage of the starship Hakodate-maru (see Problem 1406), researchers found stra ...
- POJ2546 Circular Area(计算几何)
Circular Area ...
- 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 ...
- 用开源项目circular progress button实现有进度条的Button
circular progress button可以让button实现进度条,效果和动画都做的很赞,只是有点小bug.需要注意的是按钮上的文字不能太大,否则会出现错位. 项目的地址:https://g ...
- 子类继承父类时JVM报出Error:Implicit super constructor People() is undefined for default constructor. Must define an explicit constructor
当子类继承父类的时候,若父类没有定义带参的构造方法,则子类可以继承父类的默认构造方法 当父类中定义了带参的构造方法,子类必须显式的调用父类的构造方法 若此时,子类还想调用父类的默认构造方法,必须在父类 ...
- 如何在Spring MVC Test中避免”Circular view path” 异常
1. 问题的现象 比如在webConfig中定义了一个viewResolver public class WebConfig extends WebMvcConfigurerAdapter { //配 ...
- [LeetCode] Super Ugly Number 超级丑陋数
Write a program to find the nth super ugly number. Super ugly numbers are positive numbers whose all ...
- Maven Super POM
Maven super POM defines some properties. Three ways to find it ${M2_HOME}/lib/maven-model-builder-3. ...
- java基础 super 子类调用父类
如果希望在子类中,去调用父类的构造方法,要求在子类的构造函数调用 example如下: package test; /* * 如果希望在子类中,去调用父类的构造方法,要求在子类的构造函数调用 * */ ...
随机推荐
- OF1.7中的p_rgh【翻译】
翻译自:CFD-online 帖子地址:http://www.cfd-online.com/Forums/openfoam-solving/80454-p_rgh-1-7-a.html stawrog ...
- JS-七大查找算法
顺序查找 二分查找 插值查找 斐波那契查找 树表查找 分块查找 哈希查找 查找定义:根据给定的某个值,在查找表中确定一个其关键字等于给定值的数据元素(或记录).查找算法分类:1)静态查找和动态查找:注 ...
- Qt之模型/视图(自定义风格)
Qt之模型/视图(自定义风格) 关于自定义风格是针对视图与委托而言的,使用事件与QSS都可以进行处理,今天关于美化的细节讲解一下. 先看下图: 先撇开界面的美观性(萝卜青菜,各有所爱),就现有的这些风 ...
- 数据库Sequence创建与使用
最近几天使用Oracle的sequence序列号,发现对如何创建.修改.使用存在很多迷茫点,在上网寻找答案后,根据各路大神的总结,汇总下对自己的学习成果: 在Oracle中sequence就是序号,每 ...
- Web前端笔记整理
不使用Ajax无刷新提交: header('HTTP/1.1 204 No Content'); var a=document.createElement('img'); a.setAttribute ...
- Linux笔记整理
[随时更新] ps aux | grep mysql 检测MySQL服务是否在运行 Linux查看某个进程的线程:ps -T -p <pid> 列出了由进程号为<pid>的进程 ...
- SVG-变换
transform变换 translate平移 <svg width="200" height="50"> <rect x="0&q ...
- linux禁止特定ip访问某个端口
linux禁止特定ip访问某个端口 解决方法: 禁止特定ip访问8501端口的命令0:iptables -I INPUT -s 192.168.0.232 -ptcp --dport 8501 - ...
- Linux输出信息并将信息记录到文件(tee命令)
摘自:https://www.jb51.net/article/104846.htm 前言 最近工作中遇到一个需求,需要将程序的输出写到终端,同时写入文件,通过查找相关的资料,发现可以用 tee 命令 ...
- QML使用moveToThread线程【QML工程使用C++】
一.需求来源 对于使用Qt线程,有两种方式,见本人其他文章:https://www.cnblogs.com/judes/p/6884964.html 个人认为QObject::moveToThread ...