P26776 [AtCoder] SOULBLOCK
NOI
题目描述

Problem Description

You have created a game as follows:

  • The game field can be considered as a two-dimensional plane. The player is a point located at the origin, and there are several circular objects on the field.
  • Each object has a determined value.
  • Objects remain stationary until they are collided with by another object.
  • At the start of the game, the player can choose a direction once. Then, the player will move straight in that direction.
  • When the player collides with a stationary object, the object will stick to the player at the collision point and move in the same direction as the player thereafter.
  • When a moving object collides with a stationary object, they will stick together at the collision point and move in the same direction as the player thereafter.
  • The total value of objects that are directly or indirectly connected to the player eventually becomes the player's score.

You had released this game, but it was tampered with by malicious players, causing the player to be launched in random directions. Assuming the player is launched in a uniformly random direction, output the expected value of the score the player will obtain.

Input Format

The input is given in the following format:

$ N $ $ X_1 $ $ Y_1 $ $ R_1 $ $ W_1 $ : $ X_N $ $ Y_N $ $ R_N $ $ W_N $

  • The first line contains an integer $ N $ ( $1\ \leq\ N\ \leq\ 2000$ ) representing the number of objects.
  • The following $ N $ lines contain integers $X_i,\ Y_i$ ( $-10^4\ \leq\ X_i,\ Y_i\ \leq\ 10^4$ ), $ R_i $ ( $1\ \leq\ R_i\ \leq\ 10^4$ ), and $ W_i $ ( $1\ \leq\ W_i\ \leq\ 10^4$ ) representing the center coordinates, radius, and value of each object, respectively.
  • It is guaranteed that at the start of the game, the player is not inside or on the boundary of any object.
  • It is also guaranteed that no two different objects intersect or touch each other at the start of the game.

Output Format

Output the expected value of the player's score in one line. You may output any number of decimal places, but the absolute or relative error must be less than $ 10^{-6} $.

Sample Input and Output

Sample Input #1

1
2 0 1 1

Sample Output #1

0.166666666666667

Sample Input #2

2
2 0 1 1
10 0 1 10

Sample Output #2

0.970972899218329

Sample Input #3

2
100 0 99 1
47 85 1 1

Sample Output #3

0.584414703195711

Notes/Hints

Partial Points

If you solve all the datasets satisfying the following constraint, you will be awarded 30 partial points:

  • $N\ \leq\ 100$
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1 2 0 1 1
样例输出
0.166666666666667