Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int n;
- cin>>n;
- int a[n];
- for(int i=0; i<n; i++){
- cin>>a[i];
- }
- int zbir=0;
- int vol=0;
- for(int i=0; i<n; i++){
- zbir+=a[i]+1;
- vol+=1;
- if(zbir>=n){
- break;
- }
- }
- cout<<vol<<" ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment