Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.     int n, temp, a[6], min = INT_MAX, min2 = INT_MAX, result = INT_MAX;
  7.     cin >> n;
  8.     for (int i = 0; i < 6; i++)
  9.         cin >> a[i];
  10.     for (int i = 6; i < n; i++)
  11.     {
  12.         cin >> temp;
  13.         if (a[i % 6] % 2 == 0 && a[i % 6] < min2)
  14.             min2 = a[i % 6];
  15.         if (a[i % 6] < min && a[i % 6] % 2 != 0)
  16.             min = a[i % 6];
  17.         if (min * temp < result && min * temp % 2 == 0 && min != INT_MAX)
  18.             result = min * temp;
  19.         if (min2 * temp < result && min2 != INT_MAX)
  20.             result = min2 * temp;
  21.         a[i % 6] = temp;
  22.     }
  23.     if (result != INT_MAX)
  24.         cout << result;
  25.     else
  26.         cout << "NO";
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement