首页 > 其他分享 >*Educational Codeforces Round 87 (Rated for Div. 2) C1. Simple Polygon Embedding(数论)

*Educational Codeforces Round 87 (Rated for Div. 2) C1. Simple Polygon Embedding(数论)

时间:2022-10-12 17:24:16浏览次数:66  
标签:Educational Rated Polygon LL cin Codeforces 弧度 typedef C1

https://codeforces.com/problemset/problem/1354/C1

题目大意:

给定一个数字n,表示构建出一个大小为2*n的边长的多边形;

问我们可以装下这个多边形的最小的正方形的边长是多少??

精度在一定误差范围内都算正确。
input 
3
2
4
200
output 
1.000000000
2.414213562
127.321336469

初中数学都忘光了。。。完蛋

强推这篇题解:虽然我还是不大明白
https://blog.csdn.net/qq_45949914/article/details/106226431

  1. n为偶数时,正多边形必有四条边分别和正方形的四条边重合
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;
const LL N=200200,M=2002;
#define PI 3.1415926535
int main()
{
    cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
    LL T=1;
    cin>>T;
    while(T--)
    {
        //在C语言中 sin 的参数是 弧度,而不是角度. 所有我们计算一个角度的sin 值时,应先转成弧度值.
        //弧度 =  角度 * 3.1415926 / 180.0
        LL n;
        cin>>n;
        double x=tan(PI/(2*n));
	printf("%.9lf\n",1.0/x);
    }
    return 0;
}

标签:Educational,Rated,Polygon,LL,cin,Codeforces,弧度,typedef,C1
From: https://www.cnblogs.com/Vivian-0918/p/16785259.html

相关文章