#CCBCHMOT0000011. Gấu em và gấu anh (Bear and Big Brother)
Gấu em và gấu anh (Bear and Big Brother)
Bear and Big Brother
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Initially the younger bear weighs a and the older bear weighs b, with a<=b. Every year the younger weight triples and the older doubles. Find the minimum whole years until the younger bear is strictly heavier.
Input
Two integers a and b.
Output
Print the minimum number of whole years.
Subtasks
- Subtask 1 (20%): 1 <= a=b <= 3.
- Subtask 2 (30%): 1 <= a <= b <= 5.
- Subtask 3 (50%): 1 <= a <= b <= 10.
Examples
Example 1
Input
4 7
Output
2
Explanation
After one year weights are 12 and 14; after two years 36 and 28, so answer 2.
Example 2
Input
4 9
Output
3
Explanation
The sequence is (12,18),(36,36),(108,72); equality in year two is not enough.