Bookshelves, JAVA Programming

Assignment Help:
Ask question #MBookshelves
A library decides buy bookshelves to store its books and they need to determine the bookshelves’ heights
and widths in order to minimize storage costs. The books in the library have n different heights: h1,
h2, . . . , hn. Let li be the number of books of height hi (i = 1, 2, . . . , n) in the library. Let’s suppose
that all the books have the same thickness of 1 centimeter and have the same width.
The bookshelves can have different heights and widths but they have the same depth which is the
width of the book. Ignoring the book heights, a bookshelf to store k books need to have the width of
at least k centimeter as each book is 1 centimeter thick.
A bookshelf of height hi can be used to store books of height hi or smaller. The cost for a bookshelf
with width x and height hi is fi + cix, where fi is a height-dependent cost which is independent of the
width, and ci is the height-dependent cost per one centimeter width.
Your task is to write a program to determine the minimum cost of shelving all the books.
Input
The input file consists of several data sets. The first line of the input file contains the number of data
sets which is a positive integer and is not bigger than 20. The following lines describe the data sets.
Each data set consists of five lines. The first line contains the number of book heights, n (2 = n =
10000). On the second line, there are exactly n integers hi (i = 1, . . . , n) separated by spaces. On the
third line, there are exactly n integers li (i = 1, . . . , n) separated by spaces. On the fourth line, there
are exactly n integers fi (i = 1, . . . , n) separated by spaces. The last line consists of exactly n integers
ci (i = 1, . . . , n) separated by spaces.
Output
For each data set, write in one line the minimum total cost of shelving all the books.inimum 100 words accepted#

Related Discussions:- Bookshelves

Explain the both hashset and treeset, Explain the both HashSet and TreeSet?...

Explain the both HashSet and TreeSet? HashSet is an unordered, unsorted Set. It's a Collection set which restrict duplicate elements and also repositioning of elements. I

What are stored procedures? how is it useful?, A stored procedure is a set ...

A stored procedure is a set of statements/commands which reside in the database. The stored procedure is pre-compiled and keeps the database the effort of parsing and compiling sql

I clicker, i am to find 75% of i clicker score.Each correct answer is worth...

i am to find 75% of i clicker score.Each correct answer is worth 2points and an incorrect 1point. Express grade as a percentage (i.e the max is 100%). e.g 1 no i clicker question

Java expert with tomcat tuning experience required, Java expert with tomcat...

Java expert with tomcat tuning experience needed Project Description: Want a Java expert to fix memory issues with tomcat. I need School java project - Threads Programm

Project, How can i draw E-R diagram

How can i draw E-R diagram

Write a short note on image preloading process, Write a short note on image...

Write a short note on image preloading process? The primary use of image preloading procedure is to download the image within the cache before it is actually required to displa

Board Coloring, BoardColoring.java program for 2D MXM matrix

BoardColoring.java program for 2D MXM matrix

What is JMS queue, Staging areas that have messages those have been sent an...

Staging areas that have messages those have been sent and are waiting to be read. Note that, contrary to what the name queue suggests, messages don't have to be delivered in the or

What is significance of jsf- spring integration, Spring - JSF integration i...

Spring - JSF integration is useful when an event handler wishes to explicitly invoke the bean factory to make beans on demand, such as a bean that encapsulates the business logic t

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd