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 e04b937 commit 0d48c78Copy full SHA for 0d48c78
1829D - Gold Rush.cpp
@@ -0,0 +1,32 @@
1
+// ॐ नमः शिवाय
2
+#include<bits/stdc++.h>
3
+using namespace std;
4
+#define ll long long
5
+
6
+// Code Written By: Vikash Patel
7
+// Codeforces Profile: https://codeforces.com/profile/vikashpatel
8
9
+bool split(int n, int m)
10
+{
11
+ if(n == m)
12
+ return true;
13
+ if (n % 3 != 0 || n < m)
14
+ return false;
15
+ return split(n/3, m) || split((n / 3) * 2, m);
16
+}
17
18
+int main()
19
20
+ int t;
21
+ cin>>t;
22
+ while(t--)
23
+ {
24
+ int n,m;
25
+ cin>>n>>m;
26
+ if(split(n,m))
27
+ cout<<"YES"<<endl;
28
+ else
29
+ cout<<"NO"<<endl;
30
+ }
31
+ return 0;
32
0 commit comments