PSPHERE - Points on a Sphere

Imagine a number of identically charged weightless dimensionless particles placed on the surface of a ball. They will instantly reach a state of equilibrium (a stable state of minimum energy), becoming distributed fairly evenly all round the sphere.

You probably won't be surprised to hear that Byteland has a sadly distorted electrostatic field, and the energy of the system is not governed by ordinary laws. Instead, it is inversely proportional to the distance between the closest pair of charges on the sphere.

Please help the charges find positions in which they will feel as comfortable as possible. Charges should be regarded as points in 3D space, located on the surface of the unitary sphere (with center (0,0,0) and a radius of 1).


An integer t denoting the number of test cases (t<=10), followed by t test cases, each consisting of a line with a single integer n - the number of points on the sphere (2<=n<=1000).


For each test case, output n lines consisting of three floating point numbers, corresponding to the x y z coordinates of successive points.


The score of your program is the total of scores awarded for individual test cases.

For each test case you will receive n*d points, where d denotes the minimum distance between the closest pair of points in the solution output by your program. If you place some of the points further than 10-5 from the surface of the sphere, your solution will be regarded as incorrect.


For the sample input:

a program outputting:
0.0 0.0 1.0
0.0 1.0 0.0

will receive 2.828 points.

hide comments
damocris: 2024-05-19 18:01:11

haha, you can just print the answer table, the data can be found from this url (n<=1000),

kiner_shah: 2015-09-21 17:39:43


Piyush Kumar: 2014-12-13 09:20:20

should there be a blank line between the outputs of two test cases

Added by:adrian
Time limit:5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Resource:DASM Programming League 2004 (problemset 1)