SHARE
TWEET

Untitled

vafin20 Jun 30th, 2020 934 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. НА 4 БАЛЛА РАБОЧАЯ
  2. #include <iostream>
  3. using namespace std;
  4. int main() {
  5.     int n;
  6.     cin >> n;
  7.     int a[4];
  8.     for (int i = 0; i < 4; ++i) {
  9.       cin >> a[i];
  10.     }
  11.     int minNum = 1001;
  12.     int minSum = 2001;
  13.     int i;
  14.     int x;
  15.     for (i = 0; i < n; ++i) {
  16.         cin >> x;
  17.         if(x + a[0] < minSum) {
  18.           minSum = x + a[0];
  19.         }
  20.         else if (x + minNum < minSum) {
  21.           minSum = x + minNum;
  22.         }
  23.         if (a[0] < minNum) {
  24.           minNum = a[0];
  25.         }
  26.         for (int i = 0; i < 3; ++i) {
  27.           a[i] = a[i + 1];
  28.         }
  29.         a[3] = x;
  30.     }
  31.     cout << ms << endl;
  32.     return 0;
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top