Untitled
unknown
c_cpp
2 years ago
400 B
5
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