Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input());
- A = list(map(int, input().split()));
- res = -1;
- sum = 0;
- for q in range(n):
- if A[q] <= sum + 1:
- sum = sum + A[q];
- else:
- res = sum + 1;
- break;
- if res == -1:
- res = sum + 1;
- print(res);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement