Advertisement
a53

Numere22

a53
Dec 11th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int p,q,n,x,Ep=0,Eq=0;
  7. cin>>p>>q>>n;
  8. for(int i=1;i<=n;++i)
  9. {
  10. cin>>x;
  11. while(x%p==0)
  12. ++Ep,x/=p;
  13. while(x%q==0)
  14. ++Eq,x/=q;
  15. }
  16. cout<<min(Ep,Eq);
  17. return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement