Advertisement
a53

Factori3

a53
Jan 30th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n,x,xmax=-1;
  7. cin>>n;
  8. for(int i=1;i<=n;++i)
  9. {
  10. cin>>x;
  11. int cnt=0,d=2,y=x;
  12. while(x>1)
  13. {
  14. if(x%d==0)
  15. {
  16. ++cnt;
  17. while(x%d==0)
  18. x/=d;
  19. }
  20. ++d;
  21. if(d*d>x)
  22. d=x;
  23. }
  24. if(cnt==1)
  25. if(y>xmax)
  26. xmax=y;
  27. }
  28. if(xmax==-1)
  29. cout<<"NU EXISTA";
  30. else
  31. cout<<xmax<<'\n';
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement