Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Dropping the stones
Description You have v (_{i}i = 1, ... , N). You should drop these stones by a gutter into one of the two bunkers: A or В.The mechanism of receiving bunkers switching works as follows. The stones are dropping into one of the bunkers until the weight of this bunker’s content will exceed the weight of stones in other bunker by more than D. Then the gutter switches to the other bunker. At the beginning both bunkers are empty, and the first stone falls into the bunker А. The task is to collect stones with maximum total cost in bunker B after all stones have been dropped. Input The input consists of v, also separated by spaces. All input data (except _{i}N) are integers from 0 to 10000.Output The output contains a single line with total cost of stones in the bunker B. Sample Input 4 2 2 2 2 2 1 1 1 1 Sample Output 3 Source Northeastern Europe 2001, Western Subregion |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator