fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(void)
  6. {
  7. int N;
  8. int big = 0;
  9. int small;
  10. cin >> N;
  11.  
  12. for (int i = 0; i < N; i++)
  13. {
  14. int num;
  15. cin >> num;
  16. if (i == 0) small = num;
  17. if (num > big) big = num;
  18. if (num < small) small = num;
  19. }
  20. cout << big * small;
  21. return 0;
  22. }
Success #stdin #stdout 0s 5064KB
stdin
2
4 2
stdout
8