Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- unsigned n,i,v[1000],nr2=0,nr5=0,f,p,k;
- cout<<"n=";cin>>n;
- for (i=0;i<n;i++)
- cin>>v[i];
- for (i=0;i<n;i++)
- {
- f=2;
- while (v[i]>1)
- { p=0;
- while (v[i]%f==0)
- {
- v[i]/=f;
- p++;
- }
- if (p)
- {
- if (f==2)
- nr2+=p;
- else
- if (f==5)
- nr5+=p;
- }
- f++;
- }
- }
- k=(nr2<nr5)?nr2:nr5;
- cout<<"0 apare de "<<k<<" ori in prdusul elementelor";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement