luogu#P4760. [CERC2014] Wheels

[CERC2014] Wheels

题目描述

A very important and complicated machine consists of nn wheels, numbered 1,2,...,n1, 2, . . . , n. They are actually cogwheels, but the cogs are so small that we can model them as circles on the plane.

Every wheel can spin around its center.

Two wheels cannot overlap (they do not have common interior points), but they can touch.

If two wheels touch each other and one of them rotates, the other one spins as well, as their micro-cogs are locked together.

A force is put to wheel 11 (and to no other wheel), making it rotate at the rate of exactly one turn per minute, clockwise. Compute the rates of other wheels’ movement. You may assume that the machine is not jammed (the movement is physically possible).

输入格式

The first line of input contains the number of test cases TT. The descriptions of the test cases follow:

Each test case consists of one line containing the number of wheels n(1n1000)n(1 \le n \le 1000) .

Each of the following lines contain three integers x,yx, y and r(10000x,y10000,1r10000)r(-10 000 \le x, y \le 10 000, 1 \le r \le 10 000) where (x,y)(x, y) denote the Cartesian coordinates of the wheel’s center and rr is its radius.

输出格式

For each test case, output nn lines, each describing the movement of one wheel, in the same order as in the input. For every wheel, output either p/q clockwise or p/q counterclockwise,where the irreducible fraction p/qp/q is the number of wheel turns per minute. If qq is 11, output just pp as an integer. If a wheel is standing still, output not moving.

题目大意

一个非常重要和复杂的机器由nn个轮子组成,编号为1,2,,n1,2,…,n。它们其实是齿轮,但是齿太小了,我们可以把它们近似看成成平面上的圆。

每一个齿轮都能围绕它的中心旋转。

两个齿轮不会重叠(因为它们内部没有共同的点),但它们可以互相接触。

如果两个齿轮相互接触,其中一个齿轮转动,另一个齿轮也随之转动,因为它们的齿被卡在一起。

一个力作用于齿轮1(并且力没有作用于其他齿轮),使它以每分钟转一圈的速度顺时针旋转。计算其他齿轮的运动速度。你可以假设机器没有卡住(运动在物理理论上是可以的)。

输入格式:

输入包括多组数据,第一行为组数TT

对于每组数据如下:

第一行包括一个齿轮数n,(1n1000)n,(1 \le n \le 1000)

接下来nn行每行包含三个整数x,y,r,(10000x,y10000,1r10000)x,y,r,(10000≤x,y≤10000,1≤r≤10000),其中(x,y)(x,y)表示齿轮中心的笛卡尔坐标(直角坐标),rr是其半径。

输出格式:

对于每组数据,输出nn行,第ii行为第ii个齿轮的运动状态。对于每个齿轮,输出或p/q clockwisep/q counterclockwise,其中最简分数p/q是每分钟齿轮转数。如果qq11,则输出整数pp。如果齿轮静止不动,则输出not moving

1
5
0 0 6
6 8 4
-9 0 3
6 16 4
0 -11 4

1 clockwise
3/2 counterclockwise
2 counterclockwise
3/2 clockwise
not moving