Untitled

mail@pastecode.io avatar
unknown
c_cpp
a month ago
400 B
0
Indexable
Never
#include <iostream>
using namespace std;


int main()
{
    int n;
    cin >> n;
    
    int niza[n];
    for(int i = 0; i < n; i++) {
        cin >> niza[i];
    }
    int rezultat = 0;
    int zbir = 0;
    
    for(int i = 0; i < n; i++) {
        zbir += niza[i] + 1;
        rezultat++;
        if(zbir >= n) {
            break;
        }
    }
    cout << rezultat << endl;
    return 0;
}


Leave a Comment