Advertisement
InnaSibirova

Meh 1 исправлено

Dec 18th, 2021
855
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1.  
  2. #include <stdio.h>  
  3. int main() {
  4.     int n, count = 0;
  5.     int arr[1000];
  6.     scanf("%d", &n);
  7.     for(int i = 0; i < n; i += 1) {
  8.         scanf("%d", &arr[i]);
  9.     }
  10.     for(int i = n-1; i >= 0; i -= 1) {
  11.         if(arr[i] > 0) {
  12.           count += 1;
  13.           if(count == 3) {
  14.               for(int j = i; j < n - 1; j += 1) {
  15.                   arr[j] = arr[j+1];
  16.               }
  17.           }
  18.         }
  19.     }
  20.     for(int i = 0; i < n-1; i += 1) {
  21.         printf("%d ", arr[i]);
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement