Untitled

mail@pastecode.io avatar
unknown
c_cpp
3 years ago
383 B
0
Indexable
Never
#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;
}