-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBearAndBigBrother.cpp
34 lines (23 loc) · 965 Bytes
/
BearAndBigBrother.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* 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?
Input
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.
Output
Print one integer, denoting the integer number of years after which Limak will become strictly larger than Bob. */
#include <iostream>
using namespace std;
int main()
{
int a, b;
int years;
cin >> a >> b;
while (a <= b){
a = a * 3;
b = b * 2;
years = years + 1;
}
cout << years;
return 0;
}