A Weirwood’s Age - EDITORIAL
You’re given 3 integers a, b, X.
- a = radius of the first ring,
- b = radius of the last ring,
- X = distance between 2 rings.
You have to find the age of the tree by counting the number of rings.
- We can solve this problem very easily. First, take the 3 integers as input and check their constraints.
- Then, we find the difference between the first and last rings’ radii, (b-a). We are given the distance between each ring, X.
- We divide the difference calculated between the two radii by the distance to find the number of rings.
- If the result is a floating point number, round it off with the floor value, because we need the answer in years.