codeforces 791A Bear and Big Brother

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

题意:给两个人的体重a和b,a每年变为3倍,b每年变为2倍,问你多少年a超过b

分析:水的不能再水的题,但是我还要写,因为是要告诉自己坚持最重要。

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 
 4 int main() {
 5     ios_base::sync_with_stdio(0);
 6     cin.tie(0);
 7     int a,b;
 8     int ans=0;
 9     cin>>a>>b;
10     while(a<=b){
11         ans++;
12         a=a*3;
13         b=b*2;
14     }
15     cout<<ans<<endl;
16 
17 
18 return 0;
19 }
View Code

 

posted @ 2017-06-04 23:43  BadboyQAQ  阅读(147)  评论(0编辑  收藏  举报