CF1354C1.Simple Polygon Embedding
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, n is always even, and in C2, n is always odd.
You are given a regular polygon with 2⋅n vertices (it's convex and has equal sides and equal angles) and all its sides have length 1. Let's name it as 2n-gon.
Your task is to find the square of the minimum size such that you can embed 2n-gon in the square. Embedding 2n-gon in the square means that you need to place 2n-gon in the square in such way that each point which lies inside or on a border of 2n-gon should also lie inside or on a border of the square.
You can rotate 2n-gon and/or the square.
本题的题面与问题 C2 完全相同,唯一区别在于:在问题 C1 中,n 恒为偶数;而在问题 C2 中,n 恒为奇数。
给定一个具有 2⋅n 个顶点的正多边形(即它是凸的,且所有边长相等、所有内角相等),其所有边长均为 1。我们称其为 2n-边形。
你的任务是求出能够嵌入该 2n-边形的最小正方形的面积(即边长的平方)。所谓将 2n-边形嵌入正方形,是指需将 2n-边形放置于正方形内部(含边界),使得 2n-边形内部或边界上的任意一点,也均位于该正方形内部或边界上。
你可以对 2n-边形和/或正方形进行任意角度的旋转。
输入格式
The first line contains a single integer T (1≤T≤200) — the number of test cases.
Next T lines contain descriptions of test cases — one per line. Each line contains single even integer n (2≤n≤200). Don't forget you need to embed 2n-gon, not an n-gon.
第一行包含一个整数 T(1≤T≤200)—— 表示测试用例的数量。
接下来的 T 行每行描述一个测试用例。每行包含一个偶数 n(2≤n≤200)。请注意,你需要嵌入的是 2n 边形,而非 n 边形。
输出格式
Print T real numbers — one per test case. For each test case, print the minimum length of a side of the square 2n-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed 10−6.
输出 T 个实数——每个测试用例输出一个。对于每个测试用例,输出该正 2n 边形所能嵌入的正方形的最短边长。若你的答案的绝对误差或相对误差不超过 10−6,则视为正确。
输入输出样例
输入#1
3 2 4 200
输出#1
1.000000000 2.414213562 127.321336469
输入解题思路,AI测评打分。不知道怎么写?