Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- int main()
- {
- int n, x, a, b, m;
- scanf("%i", &m);
- while(m--){
- scanf("%i", &n);
- a = 1;
- b = 0;
- while(n--)
- {
- scanf("%i", &x);
- if(!b)
- {
- if(x > a)
- b = a;
- a += x;
- }
- }
- printf("%i\n", b?b:a);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement