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:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYPY, PYTH, PYTH 3.5, RUBY, SCALA, SCM chicken, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.