We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7dec50d commit 7e0d027Copy full SHA for 7e0d027
1374B - Multiply by 2, divide by 6.cpp
@@ -0,0 +1,37 @@
1
+#include<bits/stdc++.h>
2
+using namespace std;
3
+
4
+// Code Written By: Vikash Patel
5
6
+// Codeforces Profile: https://codeforces.com/profile/vikashpatel
7
8
+int main()
9
+{
10
+ int t;
11
+ cin>>t;
12
+ while(t--)
13
+ {
14
+ int n;
15
+ cin>>n;
16
+ int c = 0;
17
+ while(n!=1)
18
19
+ if(n%6==0)
20
21
+ n /= 6;
22
+ c++;
23
+ }
24
+ else if(n%3==0)
25
26
+ n *= 2;
27
28
29
+ else
30
31
+ c = -1;
32
+ break;
33
34
35
+ cout<<c<<endl;
36
37
+}
0 commit comments