Advertisement
Josif_tepe

Untitled

Mar 15th, 2021
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 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.             if(niza[j] == 0) {
  18.                 rez += (n - j);
  19.                 break;
  20.             }
  21.         }
  22.     }
  23.     cout<<rez<<endl;
  24.     return 0;
  25. }
  26.  
  27. /*
  28. 5
  29.  4, 2, 0, 1, 3
  30.  
  31.  **/
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement