Codeforces Round #405 (Div. 2)
A. Bear and Big Brother
http://codeforces.com/contest/791/problem/A
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 |