Gears transfer different amount of speeds, depending on the size of the meshed gear.
Jack has a machine, that rotates a Gear Train. but you don't know the speed of the last gear.
Luckily, You are a great code golfer, so you can help him!
So, What should I do?
Each gear is represented by 2 numbers, the radius of the inner gear and the radius of the outer gears.
[a,b] and gear
[c,d], then the ratio between the speed of
A and the speed of
B would be
Given a list of gears (list of 2-tuples), output the speed of the last gear.
You can assume the speed of the first gear is
Worked out example
Let's say our input is
The first gear,
[6,12], would have a speed of
Then, the second gear,
[3,10], would have a speed of
1*12/3 = 4.
Then, the last gear,
[5,8], would have a speed of
4*10/5 = 8.
input output [[1,1],[2,2]] 0.5 (1/2) [[1,2],[1,2],[1,2]] 4 (2/1*2/1) [[6,12],[3,10],[5,8]] 8 (12/3*10/5)
Basic code-golf rules apply.