Saleh127

CF 573A

Jul 16th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define fellow_junior ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  6. int main()
  7. {
  8. fellow_junior
  9. ll a[200000],c,d,e,f,i,j,k,l;
  10. cin>>c;
  11. for(i=0;i<c;i++)
  12. {
  13. cin>>a[i];
  14. while(a[i]%2==0)
  15. {
  16. a[i]=a[i]/2;
  17. }
  18. while(a[i]%3==0)
  19. {
  20. a[i]=a[i]/3;
  21. }
  22. }
  23. for(i=0;i<c;i++)
  24. {
  25. if(a[i]!=a[1])
  26. {
  27. cout<<"NO"<<endl;
  28. return 0;
  29. }
  30. }
  31. cout<<"YES"<<endl;
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment