# 洛谷 “新创无际夏日公开赛—-幻想乡的西瓜”T3

### 需要注意的是，某些情况下全面积会由于切去部分而减少，如 a=0,b=180 的情况。

#include <iostream>
#include <cstdio>
#include <cmath>
#define pi 3.1415926535
using namespace std;
double dutohu(int x){return pi/180*x;}
double getarea(int a,int b)
{
double s1,s2;
s1=abs(pi*1*cos(dutohu(90-a)));
s2=abs(pi*1*cos(dutohu(90-b)));
if(a>=0&&a<90){
if(b>=0&&b<a)return (s2/2)/(s1/2);
else if(b>=a&&b<90)return (s2/2-s1/2)/pi;
else if(b>=90&&b<180)return max(s2/2-s1/2,0.0)/(pi/2+max(s2/2,s1/2));
else return 0;
}
else if(a>=90&&a<180){
if(b>=0&&b<90)return s2/2/(pi/2);
else if(b>=90&&b<a)return 1;
else return 0;
}
else if(a>=180&&a<270){
if(b>=0&&b<90)return (s1/2+s2/2)/(s1/2+pi/2);
else if(b>=90&&b<a)return 1;
else if(b>=a&&b<270)return 0;
else return max(s1/2-s2/2,0.0)/(pi/2+max(s1/2,s2/2));
}
else if(a>=270&&a<360){
if(b>=0&&b<90)return (s1+s2)/pi/2;
else if(b>=90&&b<180)return (s1/2+s2/2)/(pi/2+s2/2);
else if(b>=180&&b<270)return (s1/2)/(pi/2);
else if(b>=270&&b<a)return s1/s2;
else return (s1/2-s2/2)/pi;
}
}
int main(){
int t,a,b;
scanf("%d",&t);
for(int w=1;w<=t;w++){
scanf("%d%d",&a,&b);
printf("%.1f",getarea(a,b)*100);
puts("%");
}
return 0;
}