Josif_tepe

Untitled

Oct 8th, 2025
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <set>
  3. #include <queue>
  4. #include <vector>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     int n;
  10.     cin>>n;
  11.     vector<int> a;
  12.     for(int i=0;i<n;i++)
  13.     {
  14.         int x;
  15.         cin>>x;
  16.         a.push_back(x);
  17.     }
  18.     int z=0,m=0;
  19.     for(int i=0;z<n and i < n; i++)
  20.     {
  21.         z+=a[i] + 1;
  22.         m++;
  23.     }
  24.     cout << m << endl;
  25.     return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment