Codeforces 573A Bear and Poker Solution

  1. Solve in C++:
  2. ///**********ALLAH IS ALMIGHTY************///
  3. ///AH Tonmoy
  4. ///Department of CSE
  5. ///Islamic University,Bangladesh
  6. #include<iostream>
  7. #include<set>
  8. using namespace std;
  9. int main()
  10. {
  11. long long n,i,ar[100009],a,mx=0;
  12. set<int>s;
  13. cin>>n;
  14. for(i=0; i<n; i++)
  15. {
  16. cin>>a;
  17.  
  18. while(a%2==0)
  19. a=a/2;
  20. while(a%3==0)
  21. a=a/3;
  22. s.insert(a);
  23. }
  24. if(s.size()==1)
  25. cout<<"YES"<<endl;
  26. else
  27. cout<<"NO"<<endl;
  28.  
  29.  
  30. }

No comments

Most View Post

Recent post

Codeforces Round 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.