|Online Judge||Problem Set||Authors||Online Contests||User|
Treats for the Cows
FJ has purchased N (1 <= N <= 2000) yummy treats for the cows who get money for giving vast amounts of milk. FJ sells one treat per day and wants to maximize the money he receives over a given period time.
The treats are interesting for many reasons:
The first treat is sold on day 1 and has age a=1. Each subsequent day increases the age by 1.
Line 1: A single integer, N
Lines 2..N+1: Line i+1 contains the value of treat v(i)
Line 1: The maximum revenue FJ can achieve by selling the treats
5 1 3 1 5 2
Explanation of the sample:
Five treats. On the first day FJ can sell either treat #1 (value 1) or treat #5 (value 2).
FJ sells the treats (values 1, 3, 1, 5, 2) in the following order of indices: 1, 5, 2, 3, 4, making 1x1 + 2x2 + 3x3 + 4x1 + 5x5 = 43.
[Submit] [Go Back] [Status] [Discuss]
Home Page Go Back To top
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator