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 and servlet, I just finished a small tutorial on JSP and servlet now I...

I just finished a small tutorial on JSP and servlet now I was looking for some assignments so that I can try my hands on

Explain overriding methods and the solution, Explain Overriding Methods: Th...

Explain Overriding Methods: The Solution The object oriented solution to this problem is to describe a new class, call it SlowCar, that inherits from Car and imposes the additi

Application to control robot arm , I send you these files in order to make ...

I send you these files in order to make clear image about my task that I want you to design for me an application for PC that used to control robot arm via micro controller PIC18.

Name the common bugs which are not possible in java, Name the common bugs w...

Name the common bugs which are not possible in java Many common bugs and security problems (such as "buffer overflow") are not possible in java. Checks also make it easier to f

Describe the ? operator in java langauge, Describe The ? operator in Java l...

Describe The ? operator in Java langauge? The conditional operator just works for assigning a value to a variable, using a value within a method invocation, or in a few other w

Create an online multiple choice quiz, Create an online multiple-choice qui...

Create an online multiple-choice quiz using JSP/Servlets technology. The quiz should draw questions from an array of predefined questions (at least fifteen). You should use a meani

JAVA Cipher Program, Cryptography, the study of secret writing, has been ar...

Cryptography, the study of secret writing, has been around for a very long time, from simplistic techniques to sophisticated mathematical techniques. No matter what the form howeve

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