Rings
InterviewTime limit1sMemory limit128 MB
Given radii of N touching rings, compute how many rotations each ring after the first makes as a reduced fraction when the first ring completes one rotation.
- Level
Easy3 of 10
- Topics
- Math, Number theory, Implementation
- Solved
- No attempts yet
Problem
N rings are placed on the floor in a row so that neighboring rings touch each other.

When the first ring starts rotating, every other ring rotates with it. Some rings may rotate faster than the first ring, and some may rotate more slowly.
Given the radius of each ring in order, determine how many rotations each other ring makes when the first ring rotates exactly once. Print only the number of rotations, not the direction of rotation.
Input
The first line contains the number of rings N (3 <= N <= 100).
The second line contains N natural numbers, the radii of the rings in the order they are placed. Each radius is between 1 and 1000, inclusive.
Output
Print N-1 lines. For each ring except the first, print how many rotations that ring makes when the first ring rotates once.
Write each value as a reduced fraction A/B.