Advertisement
Guest User

sglazhivanie_posledovatelnosti

a guest
Apr 8th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5.     using namespace std;
  6.  
  7.     int N = 6, i, k;
  8.     int a[N];
  9.     for(i = 0; i < N; i++)
  10.         cin >> a[i];
  11.  
  12.     //начало своей части
  13.     int j[N];
  14.     for (i = 0; i < N; i++)
  15.        j[i] = a[i];
  16.     k = (a[0] + a[1]) / 2;
  17.     cout << k << " ";
  18.     for (i = 1; i < N - 1; i++)
  19.        j[i] = (a[i - 1] + a[i] + a[i + 1]) / 3;
  20.     for(i = 1; i < N - 1; i++)
  21.         cout << j[i] << " ";
  22.     a[N - 1] = (a[N - 2] + a[N - 1]) / 2;
  23.     cout << a[N - 1];
  24.     return 0;
  25. }
  26.  
  27. //0   1   2   3   4   5
  28. //1   9   2   10  3   11
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement