PROBLEM 30: Bear and Big Brother
Problem Reference : Codeforces
Bear Limak wants to become the largest of bears, or at least to become larger than his brother Bob.
Right now, Limak and Bob weigh a and b respectively. It's guaranteed that Limak's weight is smaller than or equal to his brother's weight.
Limak eats a lot and his weight is tripled after every year, while Bob's weight is doubled after every year.
After how many full years will Limak become strictly larger (strictly heavier) than Bob?
The only line of the input contains two integers a and b (1 ≤ a ≤ b ≤ 10) — the weight of Limak and the weight of Bob respectively.
Print one integer, denoting the integer number of years after which Limak will become strictly larger than Bob.
Solution:
- a,b = input().split()
- k = int(a)
- k1 = int(b)
- k2 = 0
- for i in range(0,10):
- k = k * 3
- k1 = k1 * 2
- k2+=1
- if k > k1 :
- break
- print(k2)
4 7
2
4 9
3
1 1
1
No comments:
Post a Comment