#include <stdio.h>
#include <stdlib.h>
#define DEBUG 1
int main ( int argc , char * argv[] ) {
long long int t;
scanf("%lld" , &t);
int i , j;
for ( i = 1 ; i <= t ; i++ ) {
long long int n;
long long int need = 1LL;
long long int life = 1LL;
scanf("%lld" , &n);
for ( j = 0 ; j < n ; j++ ) {
long long int x;
scanf("%lld" , &x);
life += x;
if ( life <= 0LL ) {
long long int temp = life;
temp = temp * -1LL;
temp = temp + 1LL;
need += temp;
life += temp;
}
}
printf("Scenario #%d: %lld\n" , i , need);
}
return 0;
}
Arpit's Newsletter read by 15000+ engineers
🔥 Thrice a week, in your inbox, an essay about system design, distributed systems, microservices, programming languages internals, or a deep dive on some super-clever algorithm, or just a few tips on building highly scalable distributed systems.