CF1354C2.Not So Simple Polygon Embedding

普及+/提高

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The statement of this problem is the same as the statement of problem C1. The only difference is that, in problem C1, nn is always even, and in C2, nn is always odd.

You are given a regular polygon with 2⋅n2 \cdot n vertices (it's convex and has equal sides and equal angles) and all its sides have length 11. Let's name it as 2n2n-gon.

Your task is to find the square of the minimum size such that you can embed 2n2n-gon in the square. Embedding 2n2n-gon in the square means that you need to place 2n2n-gon in the square in such way that each point which lies inside or on a border of 2n2n-gon should also lie inside or on a border of the square.

You can rotate 2n2n-gon and/or the square.

本题的题面与问题 C1 完全相同,唯一区别在于:在问题 C1 中,nn 恒为偶数;而在问题 C2 中,nn 恒为奇数。

给定一个具有 2⋅n2 \cdot n 个顶点的正多边形(即它是凸的,且所有边长相等、所有内角相等),其所有边长均为 11。我们称其为 2n2n-边形。

你的任务是求出能够嵌入该 2n2n-边形的最小正方形的面积(即边长的平方)。所谓将 2n2n-边形嵌入正方形,是指将 2n2n-边形置于正方形内部(含边界),使得 2n2n-边形内部或边界上的任意一点,也都位于该正方形的内部或边界上。

你可以对 2n2n-边形和/或正方形进行任意角度的旋转。

输入格式

The first line contains a single integer TT (1≤T≤2001 \le T \le 200) — the number of test cases.

Next TT lines contain descriptions of test cases — one per line. Each line contains single odd integer nn (3≤n≤1993 \le n \le 199). Don't forget you need to embed 2n2n-gon, not an nn-gon.

第一行包含一个整数 TT(1≤T≤2001 \le T \le 200)—— 表示测试用例的数量。

接下来的 TT 行每行描述一个测试用例。每行包含一个奇数 nn(3≤n≤1993 \le n \le 199)。请注意,你需要嵌入的是一个 2n2n 边形,而非 nn 边形。

输出格式

Print TT real numbers — one per test case. For each test case, print the minimum length of a side of the square 2n2n-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed 10−610^{-6}.

输出 TT 个实数——每个测试用例输出一个。对于每个测试用例,输出能嵌入该正 2n2n 边形的正方形的最短边长。若你的答案的绝对或相对误差不超过 10−610^{-6},则视为正确。

输入输出样例

  • 输入#1

    3
    3
    5
    199

    输出#1

    1.931851653
    3.196226611
    126.687663595

输入解题思路,AI测评打分。不知道怎么写?

首页