Balancing Weights
InterviewTime limit1sMemory limit256 MB
You sum the signed positions of the weights and report whether the lever tips left, tips right, or stays balanced.
- Level
Easy1 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
A lever 20 meters long rests on a massless support at its exact middle and is balanced. Several weights are placed on the lever, and you have to decide which side goes down, if any.
The torque produced by a single weight is
where is the mass of the weight and is its distance from the center. The angular acceleration of the lever follows , and the moment of inertia is , where is the perpendicular distance to the axis of rotation.
The lever itself weighs 2000 grams, spread evenly along its length. Each weight weighs 100 grams and is treated as a point mass with no size.
Input
The first line contains , the number of test cases. Each test case begins with a line containing , the number of weights. The next line contains the positions of those weights, separated by spaces. A position is measured from the center of the lever in centimeters. A negative puts the weight to the left of the center, a positive one puts it to the right.
Output
For each test case, print one line. Print Left if the lever tips to the left, Right if it tips to the right, and Equilibrium if it does not tip to either side.