Sphere Online Judge

SPOJ Problem Set (classical)

11373. Coke madness

Problem code: RPLC

David likes coke, lets say he likes it a lot... One day he was walking by a narrow street when he sees a lot of bottles of cokes, from different brands, he wants to drink it all, but he noticed that one brand gives him power, the other brand weaken him, now, he can wait and regain more energy, but he don't want to do that, he will wait at the beginning and, when he has the sufficient energy he will drink all the cokes in the street.

Please, help him find when he will be in the perfect moment to drink all the cokes.



Will start with an integer T denoting the number of test cases, then, T lines will follow, for each test case, there will be an integer N, then, in the next line will be N integers, this will be the number of cokes, and the values of the cokes in the floor (the positive one gives energy, the negative ones will take his energy).



Each test case will output the string “Scenario #i: “ where i is the number of test case analyzed, followed by the minimum energy required by David to pass the street.






4 -10 4 4 4



1 2 3 4 5

Scenario #1: 7

Scenario #2: 1

Blank line between test cases for clarification and separation”

The life of David should never reach 0 or less”





Added by:David Moran
Time limit:1s
Source limit:50000B
Memory limit:256MB
Cluster: Pyramid (Intel Pentium III 733 MHz)
Resource:Own Problem used for the RPL contest

hide comments
2014-12-18 14:10:45 Aman Agarwal
my id is 13203472
please check it as I am continuously getting compilation error...please help
2014-12-06 23:49:26 surayans tiwari(http://bit.ly/1EPzcpv)

Last edit: 2014-12-12 23:37:49
2014-12-04 16:31:40 ANUJ RATHORE
output caused 5 WA :p
2014-11-24 15:24:19 mayank
simple yet 3 was :(
2014-10-14 10:13:29 Aditya Joshi
Wow, not using long in java cost me 2 WA's.
2014-10-04 21:22:43 BADAL ROOPRAI
didnt noticed a space after ":" and got lots of wa :p

Last edit: 2014-10-04 21:23:28
2014-10-02 09:03:58 Ravi Jain
my 30th :)
2014-09-18 12:28:32 Anubhav Mathur
Ac in 1 Go :D
2014-09-18 10:13:48 abhiraj smit
finally ac after 2 WA
use long long int instead of int

Last edit: 2014-09-18 10:14:14
2014-06-25 19:40:30 sobriquet
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.