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

Jsp retrive data, how to retrive data in one block from database by click ...

how to retrive data in one block from database by click data link in another block

Define class diagram , Class diagram technique is vital within Object Orie...

Class diagram technique is vital within Object Oriented functions. Class diagrams illustrate the kinds of objects in the system and the several static relationships among them. Cl

Synchronization and its importance, What do you mean by synchronization an...

What do you mean by synchronization and its importance?

Give the example of using a class from the class library, Give the example ...

Give the example of Using a class from the class library ? You use the java.net.URL class only like you'd use any other class along with these methods in which happens to be n

Swing, can we develop paint user can draw his charcters and images in swing...

can we develop paint user can draw his charcters and images in swing

Describe the four levels of access protection, Describe the Four Levels of ...

Describe the Four Levels of Access Protection ? Any two various Java objects have one of four relations to each other. The four relations are: • The objects are in the simila

Create plug-in for adobe after effects, Project Description: We are seek...

Project Description: We are seeking software engineers to create a plug-in for Adobe after Effects (CS4 and above) that allows 3D extrusions for a layer. We are seeking somethin

Determine the meaning of finalize, Determine the meaning of finalize W...

Determine the meaning of finalize When  a  finalize method  is  defined  in  a  class,  Java  run  time  calls  finalize() whenever  it's  about  to  recycle  an object  of  t

Minimal spanning tree decreasing edge algorithm, THE FOLLOWING PROGRAM SHOU...

THE FOLLOWING PROGRAM SHOULD BE JAVA IN ECLIPSE Minimal Spanning Tree Decreasing Edge Dismissal Reverse-delete algorithm. Develop an implementation that computes the MST as fol

Ajax- html- xml- css and tomcat used in java, AJAX- HTML- XML- CSS and  To...

AJAX- HTML- XML- CSS and  Tomcat used in Java: Project Title: Zee Ads   Role                       : Developer Domain                  : Web Ads Environment

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