Josif_tepe

Untitled

Dec 20th, 2025
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main(){
  4.     int n;
  5.     cin>>n;
  6.     int a[n];
  7.     for(int i=0; i<n; i++){
  8.         cin>>a[i];
  9.        
  10.     }
  11.     int zbir=0;
  12.    int vol=0;
  13.    
  14.     for(int i=0; i<n; i++){
  15.         zbir+=a[i]+1;
  16.         vol+=1;
  17.         if(zbir>=n){
  18.             break;
  19.         }
  20.     }
  21.     cout<<vol<<" ";
  22.     return 0;
  23. }
  24.    
  25.  
Advertisement
Add Comment
Please, Sign In to add comment