https://vjudge.net/contest/393532#overview

https://vjudge.net/problem/CodeForces-791A/origin

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.

Examples

Input
4 7
Output
2
Input
4 9
Output
3
Input
1 1
Output
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.

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.

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

代码:

#include <iostream>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <cstring> using namespace std; int main()
{
int a, b;
cin >> a >> b;
int i = 0;
while(a <= b)
{
a*=3;
b*=2;
i++;
}
cout << i <<endl;
return 0;
}

  

A - Bear and Big Brother的更多相关文章

  1. Codeforces 791A Bear and Big Brother(暴力枚举,模拟)

    A. Bear and Big Brother time limit per test:1 second memory limit per test:256 megabytes input:stand ...

  2. Codeforces791A Bear and Big Brother

    A. Bear and Big Brother time limit per test 1 second memory limit per test 256 megabytes input stand ...

  3. Codeforces A. Bear and Big Brother

    ...不行.这题之后.不做1000分以下的了.很耻辱   A. Bear and Big Brother time limit per test 1 second memory limit per t ...

  4. Codeforce 791A - Bear and Big Brother

    Bear Limak wants to become the largest of bears, or at least to become larger than his brother Bob. ...

  5. 【codeforces 791A】Bear and Big Brother

    [题目链接]:http://codeforces.com/contest/791/problem/A [题意] 给你两个数字a和b; a每次乘3,b每次乘2 问你什么时候a第一次大于b [题解] 傻逼 ...

  6. Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1)A B C 水 并查集 思路

    A. Bear and Big Brother time limit per test 1 second memory limit per test 256 megabytes input stand ...

  7. 【Codeforces Round #405 ( Div 2)】题解

    Bear and Big Brother 签到题,直接模拟就可以了. Bear and Friendship Condition 满足只能是每个朋友圈中每个人和其他人都是朋友,这样的边数的确定的. 然 ...

  8. Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1) 菜鸡只会ABC!

    Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1) 全场题解 菜鸡只会A+B+C,呈上题解: A. Bear and ...

  9. Codeforces CF#628 Education 8 F. Bear and Fair Set

    F. Bear and Fair Set time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

  10. Codeforces CF#628 Education 8 C. Bear and String Distance

    C. Bear and String Distance time limit per test 1 second memory limit per test 256 megabytes input s ...

随机推荐

  1. C# 在Excel中设置文本的对齐方式、换行、旋转

    在 Excel 中,对齐.换行和旋转是用于设置单元格内容显示方式的功能.合理的设置这些文本选项可以帮助用户更好地组织和展示 Excel 表格中的数据,使表格更加清晰.易读,提高数据的可视化效果.本文将 ...

  2. 以STM32为例的MCU启动过程

    以STM32为例的MCU启动过程 在面试的时候,好多位面试官问过这个问题,即从上电后,到第一行main函数语句的执行,软件部分都在做什么.这次看了微控制器是如何启动的? |STM32 为例演示微控制器 ...

  3. File与IO流之File练习

    创建文件夹,并在其中创建文件 package Java_test; import java.io.*; public class Test { public static void main(Stri ...

  4. VS调试DMP文件

    开启DMP文件(引用:https://www.cnblogs.com/netck/p/10483933.html) 1.开启系统服务(Windows Error Reporting Service) ...

  5. Winform高级技巧-界面和代码分离的实践案例

    办法总比困难多(不会或不想用WPF MVVM模式也可以搞工控自动化和上位机编程)... 正文 活到老就该学到老.但是难道我们不可以偷懒么,老技术指哪打哪,游刃有余,如果已经炉火纯青,那么解决问题又快又 ...

  6. 2025 年实用、全面的 VS Code 插件推荐!

    前言 VS Code是一款由微软开源免费.轻量级.功能强大的源代码编辑器.其轻量级体现在基础安装简洁,仅含核心编辑功能.功能强大则源于它支持丰富的语言环境插件拓展,这种模块化设计让VS Code在源代 ...

  7. 【附源码】C语言的学生管理系统完整实现方案

    以下是一个基于C语言的学生管理系统完整实现方案,结合了结构体.链表.文件存储.菜单驱动等核心技术,参考了多个开源项目与课程设计案例. 系统支持管理员/学生双角色权限.数据持久化存储及完整增删改查功能, ...

  8. VSCode安装配置C++环境教程

    前言 IDE--集成开发环境,用于提供程序开发环境,集成了代码编写.分析.编译和调试等一体化的的套件.如C++的Visual Studio.Java的IDEA和Python的PyCharm等.IDE部 ...

  9. Review-Gate MCP,让你的 cursor request 次数翻 5 倍

    最新资讯: cursor pro 改为无限制,但某些模型(新模型?)依旧限制,看起来是一个黑盒,具体没细说,因此你可以考虑装或者不装本文的 MCP. 另外,本文属于前端社区的一次分享,只是顺带迁移到个 ...

  10. 6-nn.Module模块使用

    1. nn.Module模块使用 ① nn.Module是对所有神经网络提供一个基本的类. ② 我们的神经网络是继承nn.Module这个类,即nn.Module为父类,nn.Module为所有神经网 ...