Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define fo(n) for(int i=0;i<n;i++)
- int main(){
- int t;
- cin >> t;
- while( t-- ){
- int n , tmp , sum = -1 , ans = -2147483647;
- cin >> n;
- fo( n ){
- cin >> tmp;
- if( sum > 0 ) sum += tmp;
- else sum = tmp;
- ans = sum > ans ? sum : ans;
- }
- cout << ans << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement