Advertisement
Hamoudi30

Problem E

May 14th, 2022
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. const int N = 9;
  4. int a[N];
  5. int main() {
  6.     ios_base::sync_with_stdio(false);
  7.     cin.tie(nullptr);
  8.     cout.tie(nullptr);
  9. //    freopen("/home/hamoudi/Coding/run.in", "r", stdin);
  10.     int tt = 1;
  11.     cin >> tt;
  12.     while (tt--) {
  13.         int n = 5;
  14.         for (int i = 0; i < n; ++i) {
  15.             cin >> a[i];
  16.         }
  17. //       in this problem we only need to multiply the two largest numbers in the array
  18. //       this function will sort the array in descending order
  19.         sort(a, a + n, greater<int>());
  20. //       so we can easily access the two largest numbers
  21.         cout << a[0] * a[1] << endl;
  22.     }
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement