fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define file(name) if (fopen(name".INP", "r")){freopen(name".INP", "r", stdin); freopen(name".OUT", "w", stdout);}
  5.  
  6. int sqr(int x){return x*x;}
  7.  
  8. int power(int x, int y){
  9. if (y == 0) return 1;
  10. if (y % 2 == 0) return sqr(power(x, y/2));
  11. else return x*sqr(power(x, y/2));
  12. }
  13.  
  14. void solution(){
  15.  
  16. int a, b;
  17. cin >> a >> b;
  18. int year = 0;
  19. while (a * power(3, year) <= b * power(2, year)) year++;
  20. cout << year << "\n";
  21.  
  22. }
  23.  
  24. signed main(){
  25. ios_base::sync_with_stdio(0);
  26. cin.tie(0); cout.tie(0);
  27.  
  28. file("TEST");
  29.  
  30. int test; cin >> test;
  31. while (test --> 0) solution();
  32.  
  33. return 0;
  34. }
Success #stdin #stdout 0.01s 5404KB
stdin
2
4 7
10 3
stdout
2
0