HPU17级练习赛 J

Physics cat likes to draw shapes and figure out their area. He starts by drawing a circle. Then inside the circle, he draws the triangle XYZ - where Y is the center point of the circle, and X and Z touch the circumference of the circle. Please note that points X and Y always have the same x-coordinate.

Given L (the distance between Points X and Y) and A (the angle XYZ in degrees); help physics cat find the shaded area between the right side of the triangle and the circumference of the circle. And when we say help, we mean do all the work for him.

Input

The first line of input is T – the number of test cases.

The first line of each test case is integers L and A (1 ≤ L ≤ 1000) (1 ≤ A ≤ 180).

Output

For each test case, output on a line the area of the shaded region rounded to 6 decimal places.

Example
Input
3
1 90
2 180
10 30
Output
0.285398
6.283185
1.179939


物理猫喜欢画画,它画了一个圆,圆中有一个三角形XYZ
Y在圆心的位置  X,Z在圆周上  X和Y 有相同的x坐标
给你L(X和Y的距离,其实就是半径r),和A(角XYZ的度数) 1≤A ≤180

让算出三角形对应的扇形减去三角形后的面积 


        读英文题好难受.......

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath> 
#define PI		3.14159265358979323846
using namespace std;

int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		double r,a;
		scanf("%lf %lf",&r,&a);//半径和角度 
		double ans;
		double k=a*PI/180.0;//将角的度数转化为弧度制 
		ans=r*r*(a*PI/360.0-sin(k)/2.0);
		printf("%.6f\n",ans);
	}
	return 0;
}







猜你喜欢

转载自blog.csdn.net/hpuer_random/article/details/80433306
J