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. Hadoop集群配置(最全面总结 )(转)

    Hadoop集群配置(最全面总结) huangguisu 通常,集群里的一台机器被指定为 NameNode,另一台不同的机器被指定为JobTracker.这些机器是masters.余下的机器即作为Da ...

  2. Oracle_PL/SQL(4) 过程和函数

    create table s_sc ( SNAME VARCHAR2(20) primary key, c_grade NUMBER(6), m_grade NUMBER(6), e_grade NU ...

  3. widget jquery 理解

    jquery ui 的所有组件都是基于一个简单,可重用的widget. 这个widget是jquery ui的核心部分,实用它能实现一致的API,创建有状态的插件,而无需关心插件的内部转换. $.wi ...

  4. gerrit管理下的git代码提交小技巧

    1.提交代码git checkout targetbranch 切换至目标分支git pull origin targetbranch 拉取目标分支最新内容git add 修改文件git commit ...

  5. Laravel policy 的应用

    Laravel 提供更简单的方式来处理用户授权动作.类似用户认证,有 2 种主要方式来实现用户授权:gates 和策略,我这里主要讲解下策略的使用. 文档 上面有详细的说明,我这里只根据自己使用过程做 ...

  6. Ubuntu服务器如何搭建PPTPD(原创保证可用)

    Ubuntu是一款基于linux的操作系统,无需许可和订购的费用,Ubuntu Server可以帮助您高效地扩展您的数据中心.它精简的架构和自动化部署的能力让您只需花费更少的运算能力和资源,便可提供更 ...

  7. python 部分数据处理代码

    # -*- coding:utf8 -*- import os import jieba.posseg as pseg # -*- coding:utf8 -*- import os  def spl ...

  8. crud树型结构数据

    小型数据,比如标签,部门之类的,可以组织数据,成层状结构,一并返回前端,节省请求次数:但是大型数据,比如省市区等等联动,如果一并返回组织好的数据,查询量大,页面多次刷新,恶意请求,放入缓存还可以,其实 ...

  9. 【Web】Nginx Rewrite规则

    Rewrite介绍 Rewrite主要的功能就是实现URL的重写,Nginx的Rewrite规则采用Pcre,perl兼容正则表达式的语法规则匹配,如果需要Nginx的Rewrite功能,在编译Ngi ...

  10. Java关键字解释及作用

    JAVA 关键字及其作用解释 1. 访问控制 1) private 私有的 private 关键字是访问控制修饰符,可以应用于类.方法或字段(在类中声明的变量). 只能在声明 private(内部)类 ...