Advertisement
Saleh127

Untitled

Apr 17th, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int t,d=0,e,f,i,j,k,l;
  6. cin>>t;
  7. int a[t],b[t];
  8. for(i=0;i<t;i++)
  9. {
  10. cin>>a[i];
  11. d+=a[i];
  12. b[i]=d;
  13. }
  14. cin>>e;
  15. int c[e];
  16. for(j=0;j<e;j++)
  17. {
  18. cin>>c[j];
  19. }
  20. for(j=0;j<e;j++)
  21. {
  22. f=lower_bound(b,b+t,c[j])-b+1;
  23. cout<<f<<endl;
  24. }
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement