daily pastebin goal
72%
SHARE
TWEET

Untitled

a guest Mar 24th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. /// Typedef
  6. typedef long long ll;
  7.  
  8. #define sc1(a) scanf("%lld",&a)
  9. #define sc2(a,b) scanf("%lld %lld",&a,&b)
  10.  
  11. #define pf1(a) printf("%lld\n", a)
  12. #define pf2(a,b) printf("%lld %lld\n",a,b)
  13.  
  14. int main() {
  15.  
  16.     //seive();
  17.     //preCal();
  18.  
  19.     ll tc, num, t = 1, choose;
  20.  
  21.     //freopen("/opt/Coding/clion code/input.txt", "r", stdin);
  22.     //freopen("/opt/Coding/clion code/output.txt", "w", stdout);
  23.  
  24.  
  25.     sc2(num, tc);
  26.  
  27.  
  28.     if(tc % num != 0) return cout << "-1" << endl,0;
  29.  
  30.     ll div = tc / num;
  31.  
  32.     ll ans = 0;
  33.  
  34.     while (div % 2 == 0){
  35.         ans++;
  36.         div /= 2;
  37.     }
  38.  
  39.     while (div % 3 == 0){
  40.         ans++;
  41.         div /= 3;
  42.     }
  43.  
  44.     if(div == 1) cout << ans << endl;
  45.     else cout << "-1" << endl;
  46.  
  47.     return 0;
  48. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top