Saleh127

CF 1405B

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