Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #define N 1005
- using namespace std;
- int main()
- {
- int x,d,p,fmax=0,pmax=0;
- int n,i;
- cin>>n;
- for(i=1;i<=n;i++)
- {
- cin>>x;///fiecare numar
- ///descompun x;
- d=2;
- while(x!=1)
- {
- p=0;
- while(x%d==0){x/=d; p++;}
- if(p!=0)
- {
- if(fmax<d) {fmax=d;pmax=p;}///calculez fact max si puterea
- else if(fmax==d)pmax+=p;
- }
- if(d*d<x)d++;
- else d=x;
- }
- }
- cout<<fmax<<" "<<pmax;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement