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 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h &g...

Powered by Blogger.