A - Bear and Big Brother
Problem Link: [Codeforces 791A##link##]
- [tab]
- C++
#include<iostream> using namespace std; int main() { int d=0; long long a,b; cin>>a>>b; while(a<=b) { a=a*3; b=b*2; d++; } cout<<d; return 0; }
- Python 3
num_array = input().split() num1 = int(num_array[0]) num2 = int(num_array[1]) count = 0 while num1 <= num2: num1 *= 3 num2 *= 2 count += 1 print(count)
- JAVA
import java.util.Scanner; public class Problem_791A_Bear_and_Big_Brother { public static void main(String[] args) { Scanner input = new Scanner(System.in); int a = input.nextInt(); int b = input.nextInt(); int year = 0; while(a <= b) { a *= 3; b *= 2; year++; } System.out.println(year); input.close(); } }