Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. int main()
  5. { long long n,m1=0,m2=0,x1=0,x2=0,a,i;
  6. cin>>n;
  7. for(i=1; i<=n; i++)
  8. {
  9. cin>>a;
  10. if(m1>a)
  11. {
  12. m2=m1;
  13. m1=a;
  14. }
  15. else
  16. if(x1<a)
  17. {
  18. x2=x1;
  19. x1=a;
  20.  
  21. }
  22. else if(x2<a)
  23. x2=a;
  24. }
  25. cout<<max(x1*x2,m1*m2);
  26.  
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement