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 JMS, JMS ((java messaging service))is an acronym used for Java Mess...

JMS ((java messaging service))is an acronym used for Java Messaging Service. It is Java's answer to formed software using asynchronous messaging. It is one of the official specific

File I/O, Write a program that reads both the girl and boy files into memor...

Write a program that reads both the girl and boy files into memory using arrays. Then, allow the user to input a name. The program should search through both arrays. If there is

Program to find prime number from linked list, For this assignment you are ...

For this assignment you are provided with a class called LNode which can be used as a list node for a linked list of ints. You are also provided with an abstract class called LList

Application of server clustering? , An application server cluster has of a ...

An application server cluster has of a number of application servers loosely coupled on a network. The server group or server cluster is usually distributed over a number of nodes

What is the purpose to use the enableevents method, What is the purpose to ...

What is the purpose to use the enableEvents() method?

What are the implicit objects in jsp, Implicit objects are formed by the we...

Implicit objects are formed by the web container and have information related to a particular request, page, or application. They are request, response, pageContext, session, appli

Can a class implementing a remote interface, Can a class implementing a Rem...

Can a class implementing a Remote interface have non remote processes? Ans) Yes. Those processes behave as normal java process operating within the JVM.

I want fitlife app for android - ios, I want FitLIFE app for Android, IOS, ...

I want FitLIFE app for Android, IOS, Windows Project Description: Hello, I want to develop an app for Android, IOS and Windows Phone. This app will be work with open source B

I need java web applications development, I need Java Web Applications Deve...

I need Java Web Applications Development Project Description: MySQL databases, Oracle. SVN, GIT team collaborations. Skills required: Java, SQL, Software Architectur

What are the role of keywords in java, What are the role of Keywords in jav...

What are the role of Keywords in java? Keywords are identifiers such as public, static and class in which have a special meaning inside Java source code and outside of comments

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