Advertisement
Josif_tepe

Untitled

Mar 15th, 2021
89
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. #include <vector>
  3. #include <cstring>
  4. #include <algorithm>
  5. #include <map>
  6. using namespace std;
  7. int main(){
  8.     int n;
  9.     cin>>n;
  10.     int niza[n];
  11.     for(int i = 0; i < n; i++){
  12.         cin>>niza[i];
  13.     }
  14.     int rez = 0;
  15.     for(int i = 0; i < n; i++){
  16.         for(int j = i; j < n; j++){
  17.             for(int k = i; k <= j; k++){
  18.                 if(niza[k] == 0)
  19.                     rez++;
  20.                 else
  21.                     continue;
  22.             }
  23.         }
  24.     }
  25.     cout<<rez<<endl;
  26.     return 0;
  27. }
  28.  
  29. /*
  30. 5
  31.  4, 2, 0, 1, 3
  32.  
  33.  **/
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement