Advertisement
Josif_tepe

Untitled

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