본문으로 바로가기

Codeforces Round #405 (Div. 2) A

category PS - OJ/Codeforces 2017. 3. 19. 15:18

Codeforces Round #405 (Div. 2)

A. Bear and Big Brother

http://codeforces.com/contest/791/problem/A


두 숫자 a,b가 주어진다.

a는 3배씩 증가하고 b는 2배씩 증가할 때

a>b가 되는 순간을 구하는 문제


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int a, b;
    scanf("%d%d",&a,&b);
    int cnt=0;
    for(int i=0; i<=1000; i++) {
        a*=3;
        b*=2;
        cnt++;
        if(a>b) break;
    }
    printf("%d", cnt);
    return 0;
}
cs