Advertisement
myloyo

6.5.5

Dec 4th, 2022 (edited)
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n, k1, k2;
  8.     cin >> n >> k1 >> k2;
  9.     int* a = new int[n];
  10.     for (int i = 0; i < n; i++) {
  11.         cin >> a[i];
  12.     }
  13.     for (int i = 0; i < n; i++) {
  14.         if (i >= k1-1 && i <= k2-1) {
  15.             for (int j = i; j < n; j++) {
  16.                 a[j] = a[j + 1];
  17.             }
  18.             n--;
  19.             i--;
  20.             k2--;
  21.         }
  22.     }
  23.     for (int i = 0; i < n; i++) {
  24.         cout << a[i] << " ";
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement