CodeForces 791A Bear and Big Brother

来源:互联网 发布:php websocket 框架 编辑:程序博客网 时间:2024/05/29 13:57

题目链接:http://codeforces.com/contest/791/problem/A
题意:给你一个a,一个b,a每天都乘3,b每天都乘2,问你几天后a超过b
解析:a,b都不大,直接模拟即可

#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#include <iostream>using namespace std;const int maxn = 2e5+100;int main(){    int a,b;    int ans = 0;    scanf("%d %d",&a,&b);    while(a<=b)    {        a *= 3;        b *= 2;        ans++;    }    printf("%d\n",ans);    return 0;}
0 0
原创粉丝点击