The Rich Rice Trader
All submissions for this problem are available.
Kamal is a rice trader and has purchased N packets of rice
(1<=N<=1000). He wants to maximize his money by selling those packets. He
sells one packet per day. He stores these packets in a drum which could be
opened from both the ends and packets can be taken out from either sides. All
the packets are of different varieties which have different costs class=GramE>c(i) (1<=c(i)<=1000).
As old the packet of rice is the costlier it becomes. Consider the initial age
of the packet age= 1. As the no of
days increases cost becomes c(i)* style='mso-bidi-font-weight:normal'>age.
Find the maximum optimal revenue that Kamal could earn by
selling these packets.
Line one contains a single integer, N
For the Rest of lines LINE i+1 contains the value of packet
of rice c(i)
The maximum revenue Kamal can achieve by selling the
|Time Limit:||5 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.