Codeforces Round #532 (Div. 2) C. NN and the Optical Illusion

题解

题目大意 一个圆a外面套着一圈b 给你a的半径和b的数量 求b半径

如图 设b半径为x = r * sin(α) / (1 - sin(α)) α为红蓝色夹角=360/b数量
Codeforces Round #532 (Div. 2) C. NN and the Optical Illusion

AC代码

#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int INF = 0x3f3f3f3f;

int main()
{
#ifdef LOCAL
	//freopen("C:/input.txt", "r", stdin);
#endif
	double n, r;
	cin >> n >> r;
	double d = 360.0 / n / 2; //角度
	double b = sin(d * 3.1415926535897932384 / 180);
	double x = r * b / (1 - b);
	printf("%.10lf\n", x);

	return 0;
}