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/

全部评论

相关推荐

刚刷到字节跳动官方发的消息,确实被这波阵仗吓了一跳。在大家还在纠结今年行情是不是又“寒冬”的时候,字节直接甩出了史上规模最大的转正实习计划——ByteIntern。咱们直接看几个最硬的数,别被花里胡哨的宣传词绕晕了。首先是“量大”。全球招7000多人是什么概念?这几乎是把很多中型互联网公司的总人数都给招进来了。最关键的是,这次的资源分配非常精准:研发岗给了4800多个Offer,占比直接超过六成。说白了,字节今年还是要死磕技术,尤其是产品和AI领域,这对于咱们写代码的同学来说,绝对是今年最厚的一块肥肉。其次是大家最关心的“转正率”。官方直接白纸黑字写了:整体转正率超过50%。这意味着只要你进去了,不划水、正常干,每两个人里就有一个能直接拿校招Offer。对于2027届(2026年9月到2027年8月毕业)的同学来说,这不仅是实习,这简直就是通往大厂的快捷通道。不过,我也得泼盆冷水。坑位多,不代表门槛低。字节的实习面试出了名的爱考算法和工程实操,尤其是今年重点倾斜AI方向,如果你简历里有和AI相关的项目,优势还是有的。而且,转正率50%也意味着剩下那50%的人是陪跑的,进去之后的考核压力肯定不小。一句话总结:&nbsp;27届的兄弟们,别犹豫了。今年字节这是铁了心要抢提前批的人才,现在投递就是占坑。与其等到明年秋招去千军万马挤独木桥,不如现在进去先占个工位,把转正名额攥在手里。
喵_coding:别逗了 50%转正率 仔细想想 就是转正与不转正
字节7000实习来了,你...
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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