?
# | Author | Problem | Lang | Verdict | Time | Memory | Sent | Judged | |
---|---|---|---|---|---|---|---|---|---|
99936574 |
Practice: Mr_Knowbody |
1141A - 34 | C++17 (GCC 7-32) | Accepted | 46 ms | 12 KB | 2020-11-29 23:22:04 | 2020-11-29 23:22:04 |
#include<bits/stdc++.h> using namespace std; #define ll long long #define all(v) v.begin(),v.end() #define endll "\n" #define fin freopen("input.txt","r",stdin); #define fout freopen("output.txt","w",stdout); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n,m; cin >> n >> m; int c=0; for(int i=0;i<=25;i++){ for(int j=0;j<=25;j++){ if((ll)n*pow(2,i)*pow(3,j)==m){ cout << i+j << endl; return 0; } } } cout << -1 << endl; return 0; }
?
?
?
?