Saleh127

cc wwalk

May 30th, 2020
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int t;
  6. scanf("%d",&t);
  7. while(t--)
  8. {
  9. int a[100005],c[100005],d,e=0,f=0,g=0;
  10. scanf("%d",&d);
  11. for(int i=0;i<d;i++)
  12. {
  13. scanf("%d",&a[i]);
  14. }
  15. for(int i=0;i<d;i++)
  16. {
  17. scanf("%d",&c[i]);
  18. }
  19. for(int j=0;j<d;j++)
  20. {
  21. e+=a[j];
  22. f+=c[j];
  23. if(a[j]==c[j] && e==f)
  24. {
  25. g+=c[j];
  26.  
  27. }
  28. }
  29. printf("%d\n",g);
  30. }
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment