791A. Bear and Big Brother

791A. Bear and Big Brother

791A. Bear and Big Brother

  • time limit per test1 second
  • memory limit per test256 megabytes
  • inputstandard input
  • outputstandard output

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.

现在,利马克和鲍勃分别称a和b。保证利马克的体重小于或等于他哥哥的体重。

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.

输入的唯一一行包含两个整数a和b(1) ≤ A. ≤ B ≤ 10) -Limak的重量和Bob的重量。

Output

Print one integer, denoting the integer number of years after which Limak will become strictly larger than Bob.

打印一个整数,表示Limak严格大于Bob的整数年数。 Examples

input1

4 7

output1

2

input2

4 9

output2

3

input3

1 1

output3

1

Note

In the first sample, Limak weighs 4 and Bob weighs 7 initially. After one year their weights are 4·3 = 12 and 7·2 = 14 respectively (one weight is tripled while the other one is doubled). Limak isn't larger than Bob yet. After the second year weights are 36 and 28, so the first weight is greater than the second one. Limak became larger than Bob after two years so you should print 2.

在第一个样本中,Limak最初重4磅,Bob最初重7磅。一年后,他们的体重是4·3 = 12和7·2 = 分别为14(一个重量增加了三倍,另一个重量增加了一倍)。利马克还不比鲍勃大。第二年后,体重分别为36和28,因此第一年的体重大于第二年。两年后,Limak变得比Bob大,所以你应该打印2。

In the second sample, Limak's and Bob's weights in next years are: 12 and 18, then 36 and 36, and finally 108 and 72 (after three years). The answer is 3. Remember that Limak wants to be larger than Bob and he won't be satisfied with equal weights.

在第二个样本中,利马克和鲍勃未来几年的体重是:12和18,然后是36和36,最后是108和72(三年后)。答案是3。记住,利马克想要比鲍勃大,他不会满足于重量相等。

In the third sample, Limak becomes larger than Bob after the first year. Their weights will be 3 and 2 then.

在第三个样本中,利马克在第一年后变得比鲍勃大。他们的体重将是3和2。

Solution
Code
#include <iostream>
using namespace std;
//791A. Bear and Big Brother
int main(){
    int a,b =0;
    cin >> a >> b;
    int n = 0;//n:Limak严格大于Bob的整数年数
    while(a <= b){
        a *= 3;
        b *= 2;
        n++;
    }
    cout << n << endl;
    return 0;
}
CodeForces 文章被收录于专栏

https://codeforces.ml/

全部评论

相关推荐

牛客刘北:如果暑期实习是27届的话,你要晚一年才会毕业,企业为什么会等你呢?要搞清时间逻辑呀!27届现在实习只能是在暑假实习,这是日常实习,不是暑期实习。所以多去投日常实习吧,暑期实习肯定不会要你的
点赞 评论 收藏
分享
05-29 09:02
门头沟学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务