Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int p,q,n,x,Ep=0,Eq=0;
- cin>>p>>q>>n;
- for(int i=1;i<=n;++i)
- {
- cin>>x;
- while(x%p==0)
- ++Ep,x/=p;
- while(x%q==0)
- ++Eq,x/=q;
- }
- cout<<min(Ep,Eq);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement