Untitled

 avatar
unknown
c_cpp
4 years ago
383 B
2
Indexable
#include <iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    long long result = 0;
    for(int i = 0; i < n; i++) {
        for(int j = i; j < n; j++) {
            if(a[j] == 0) {
                result += (n - j);
            }
        }
    }
    cout << result << endl;
return 0;
}
Editor is loading...