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 |
'PS - OJ > Codeforces' 카테고리의 다른 글
Codeforces Round #405 (Div. 2) C (0) | 2017.03.19 |
---|---|
Codeforces Round #405 (Div. 2) B (0) | 2017.03.19 |
Codeforces Round #381 (Div. 2) (0) | 2017.01.23 |
Codeforces Round #393 (Div. 2) (8VC Venture Cup 2017 - Final Round Div. 2 Edition) (0) | 2017.01.23 |
Codeforces Round #392 (Div. 2) (0) | 2017.01.23 |