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.

分析:给你两个数字a和b; a每次乘3,b每次乘2,问你什么时候a第一次大于b!

题目链接:http://codeforces.com/contest/791/problem/A

下面给出AC代码:

 #include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b,i;
int c,d;
while(scanf("%d%d",&a,&b)!=EOF)
{
int ans=;
if(a-b>)
printf("0\n");
else if(a-b==)
printf("1\n");
while(a-b<)
{
ans++;
a*=;
b*=;
if(a-b>)
{
printf("%d\n",ans);
break;
}
else if(a-b==)
{
printf("%d\n",ans+);
break;
}
}
}
return ;
}

Codeforces 791A Bear and Big Brother(暴力枚举,模拟)的更多相关文章

  1. Codeforces 425A Sereja and Swaps(暴力枚举)

    题目链接:A. Sereja and Swaps 题意:给定一个序列,能够交换k次,问交换完后的子序列最大值的最大值是多少 思路:暴力枚举每一个区间,然后每一个区间[l,r]之内的值先存在优先队列内, ...

  2. Codeforces Round #253 (Div. 2)B(暴力枚举)

    就暴力枚举所有起点和终点就行了. 我做这题时想的太多了,最简单的暴力枚举起始点却没想到...应该先想最简单的方法,层层深入. #include<iostream> #include< ...

  3. Codeforces A. Bear and Big Brother

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

  4. codeforces 869A The Artful Expedient【暴力枚举/亦或性质】

    A. time limit per test 1 second memory limit per test 256 megabytes input standard input output stan ...

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

  6. Codeforces 653C Bear and Up-Down【暴力】

    题目链接: http://codeforces.com/problemset/problem/653/C 题意: 给定序列,偶数位的数字比两边都大,则成为nice,只可以交换两个数字,问有多少种交换方 ...

  7. Codeforces Round #258 (Div. 2)C(暴力枚举)

    就枚举四种情况,哪种能行就是yes了.很简单,关键是写法,我写的又丑又长...看了zhanyl的写法顿时心生敬佩.写的干净利落,简直美如画...这是功力的体现! 以下是zhanyl的写法,转载在此以供 ...

  8. CodeForces 550B Preparing Olympiad(DFS回溯+暴力枚举)

    [题目链接]:click here~~ [题目大意] 一组题目的数目(n<=15),每一个题目有对应的难度,问你选择一定的题目(大于r个且小于l个)且选择后的题目里最小难度与最大难度差不小于x, ...

  9. HDU 4930 Fighting the Landlords(暴力枚举+模拟)

    HDU 4930 Fighting the Landlords 题目链接 题意:就是题中那几种牌型.假设先手能一步走完.或者一步让后手无法管上,就赢 思路:先枚举出两个人全部可能的牌型的最大值.然后再 ...

随机推荐

  1. 简单介绍什么是协程及其在ES6中的实现方式

    协程,英文名coroutine,是一种执行过程可以被暂停和恢复的方法.各个协程之间相互协作完成一个任务. 让我们来看一个关于发挥协程作用的例子.假定我们有一个生产者和消费者的关系,生产者创建物品并将物 ...

  2. sed使用范例

    本文同时发表在https://github.com/zhangyachen/zhangyachen.github.io/issues/32 记录下sed编译器的常见使用方法. sed编辑器基于输入到命 ...

  3. 关于PLC

    学电气的一方面是单片机,一方面是PLC,,,,常常看到说选择比努力更重要,,单片机都很熟悉了,我就来介绍一下PLC..... 然后呢我先吹吹牛,,,目的是让大家相信我介绍的PLC绝对是亲身体验.... ...

  4. Jmeter+Ant+Jenkins接口自动化测试(一)_环境部署

    前言: 2017年最后一个月份,今天抽出时间把之前的一些记录分享出来,也为今年画上个简单的句号吧,无论好与坏,无论成功与失败,简单的记忆,不要留下点点空白. 特别提示: 知识是用来分享的,但是也要尊重 ...

  5. Java自己动手写连接池三

    Java自己动手写连接池三,核心代码; package com.kama.cn; import java.sql.Connection;import java.util.ArrayList;impor ...

  6. Python第二十二天 stat模块 os.chmod方法 os.stat方法 pwd grp模块

    Python第二十二天   stat模块  os.chmod方法  os.stat方法  pwd  grp模块 stat模块描述了os.stat(filename)返回的文件属性列表中各值的意义,根据 ...

  7. jquery中this和event.target的区别

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. Django__WSGI

    WEB应用的本质 : 1. 浏览器发送一个http请求 2. 服务器收到请求,生成一个html文档 3. 服务器把HTML文档作为HTTP响应的body发送给浏览器 4. 浏览器收到http响应,从h ...

  9. Sp_Lock

    SP_LOCK 其显示信息为: Spid:进程ID号(要发现哪些用户和该spid相连,你就要执行存储过程sp_who) Dbid:数据库ID号(可以在主数据库中的sysdatabases表格中找到它) ...

  10. 关于 python 新式类和旧式类继承顺序的验证

    参考:http://www.cnblogs.com/blackmatrix/p/5630515.html 官方:https://docs.python.org/2/tutorial/classes.h ...