A10942 | Bear and Big Brother
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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?
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?
输入格式
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.
输出格式
Print one integer, denoting the integer number of years after which Limak will become strictly larger than Bob.
输入输出样例
输入 #1
4 7
输出 #1
2
输入 #2
4 9
输出 #2
3
输入 #3
1 1
输出 #3
1
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.
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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted