A. Bear and Big Brother
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard 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.

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.

——————————————————————————————————

题目的意思是输入两个数,第一个数每次*3,第二个数每次*2,问什么时候第一个数比第二个数大

思路:大水题

#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <climits> using namespace std; #define LL long long
const int INF = 0x3f3f3f3f;
int main()
{
int m,n;
scanf("%d%d",&m,&n);
int cnt=0;
while(m<=n)
{
m*=3;
n*=2;
cnt++;
}
printf("%d\n",cnt);
return 0;
}

  

Codeforces791A 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. Codeforces A. Bear and Big Brother

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

  3. 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. ...

  4. 【codeforces 791A】Bear and Big Brother

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

  5. 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 ...

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

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

  7. 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 ...

  8. 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 ...

  9. 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. python 虚拟环境操作 virtualenv +virtualenvwrapper

    Window 下创建python的虚拟环境 下载工具 pip install virtualenv 创建虚拟环境目录 # 注意此命令创建的虚拟环境目录是在当前目录下 virtualenv testen ...

  2. c# mac地址 和http://xx.xx.xx/ 正则表达式匹配

    Mac  :^([0-9a-fA-F]{2})(([/\s:][0-9a-fA-F]{2}){5})$ C# 书写方式 一下是允许mac中间间隔符是“:”或者“-”两种输入方式 并且我把上边的正则表达 ...

  3. Task 和 ThreadPool

    在C#中 TASK 和 ThreadPool 都可以完成多任务并行的工作.但是 TASK实际上是微软定义好的,基于 ThreadPool 的一个类.这里面微软做了很多优化工作. Task Parall ...

  4. PopupWindow与Edittext结合使用所遇到的坑

    PopupWindow与Edittext结合使用一起实现目的:既可以编辑输入想要的内容,还可以通过下拉列表来实现内容的选择. 我就是这样的一个目的,结果很简单的目的却遇到了很大的坑,下面我将把我遇到的 ...

  5. Kali xrdp远程桌面

    发现论坛没有该教程,在这里分享给需要的基友.源还是要更新的,楼主在网上百度的kali源,而不是linux源,比163.搜狐的源好些.首先安装xrdp: apt-get install xrdp 复制代 ...

  6. BFS和DFS (java版)

    package com.algorithm.test; import java.util.ArrayDeque; import java.util.Scanner; public class DfsA ...

  7. robot framework测试驱动无法定位页面元素

    robot framework错误提示: [ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: NoSuchW ...

  8. ajax之Content-Type决定form-data方式提交还是request-payloud等

    1.post请求的Content-Type为application/x-www-form-urlencoded,参数是在请求体中,即上面请求中的Form Data. 在servlet中,可以通过req ...

  9. JS在页面根据数量改变总价及按钮进行格式验证

    分两部分,第一部分是在页面上,根据数量的input标签内容,动态更新总价标签的内容,代码如下: <script type="text/javascript"> $(do ...

  10. DOM-DOMTree-查找

    1. 什么是DOM: Document Object Model 专门操作网页内容的API js=ES+DOM+BOM DOM是由W3C指定的API标准 为什么: 为了统一各个浏览器操作网页内容的AP ...