杭电2080
1 //余玄定理+反三角函数 2 #include<stdio.h> 3 #include<math.h> 4 #define pi 3.14159265 5 int main() 6 { 7 int n; 8 double x1,x2,y1,y2,a,b,c,ans; 9 while(~scanf("%d",&n)) 10 { 11 while(n--) 12 { 13 scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2); 14 a=sqrt(x1*x1+y1*y1); 15 b=sqrt(x2*x2+y2*y2); 16 c=sqrt((y2-y1)*(y2-y1)+(x2-x1)*(x2-x1)); 17 ans=acos((a*a+b*b-c*c)/(2*a*b))*180/pi; 18 printf("%.2lf\n",ans); 19 } 20 } 21 }