Untitled

 avatar
unknown
c_cpp
a year ago
400 B
4
Indexable
#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;
}


Editor is loading...
Leave a Comment