Advertisement
Josif_tepe

Untitled

Mar 11th, 2021
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.     int n;
  7.     cin >> n;
  8.     int a[n];
  9.     for(int i = 0; i < n; i++) {
  10.         cin >> a[i];
  11.     }
  12.     long long result = 0;
  13.     for(int i = 0; i < n; i++) {
  14.         for(int j = i; j < n; j++) {
  15.             for(int k = i; k <= j; k++) {
  16.                 if(a[k] == 0) {
  17.                     result += 1;
  18.                     break;
  19.                 }
  20.             }
  21.         }
  22.     }
  23.     cout << result << endl;
  24. return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement