Codeforces 573A Bear and Poker Solution
- Solve in C++:
- ///**********ALLAH IS ALMIGHTY************///
- ///AH Tonmoy
- ///Department of CSE
- ///Islamic University,Bangladesh
- #include<iostream>
- #include<set>
- using namespace std;
- int main()
- {
- long long n,i,ar[100009],a,mx=0;
- set<int>s;
- cin>>n;
- for(i=0; i<n; i++)
- {
- cin>>a;
- while(a%2==0)
- a=a/2;
- while(a%3==0)
- a=a/3;
- s.insert(a);
- }
- if(s.size()==1)
- cout<<"YES"<<endl;
- else
- cout<<"NO"<<endl;
- }
No comments