DES: Gives an n line segment. Ask for the desired number of line segments per shot.
Very simple. is the angle between the ends of each segment and the lines connected to the origin. If the angle is greater than pi. is 2pi minus this angle. The final divided by the total value of 2PI is the desired expectation.
Atan2 (y, x). Represents the angle (y, x) of the Ray and the x-axis forward composition.
I don't know if I can think of the game.
#include <stdio.h>#include<string.h>#include<math.h>#include<iostream>#include<iomanip>using namespacestd;intMain () {intT; DoublePI =3.1415926; scanf ("%d", &t); while(t--) { intN; scanf ("%d", &N); intx1, y1, x2, y2; DoubleAns =0.0; Doubletemp; while(n--) {scanf ("%d%d%d%d", &x1, &y1, &X2, &y2); Temp= Fabs (atan2 (y1, x1)-atan2 (y2, x2)); if(Temp > Pi) temp =2*PI-temp; Ans+=temp; } ans/=2*Pi; printf ("%.5lf\n", ans); }}
Look
Uvslive 6324 to seek the expectation of archery coverage