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

Program for write a class with the header, PART1: Write a class with the...

PART1: Write a class with the header public class OrderedPair > implements Comparable > instance variables private Key x private Key y constructor publicOrd

What is an xml namespace?, Question 1 What is Response Redirection? Explai...

Question 1 What is Response Redirection? Explain in brief Question 2 What is JDBC? Explain Question 3 Write a short note on Expressions Question 4 What is an XML na

Build KNN Classifier in Java, Can you help? this assignment I will need to ...

Can you help? this assignment I will need to build a very straightforward and fully functional machine learning classifier with the K-Nearest Neighbor (KNN) algorithm. The KNN mode

What are the advantages of multimedia presentations, What are the advantage...

What are the advantages of multimedia presentations? Write any five. Multimedia presentation is a excellent tool for effective communication: Advantages: 1. Easy to make l

I need to make clone of an android app, I need to Make clone of an Android ...

I need to Make clone of an Android app Project Description: Make a total duplicate of the App: Camp and RV Campgrounds Plus The only difference will be the name (as it

Execution process of java bytecode, Execution Process of Java bytecode ...

Execution Process of Java bytecode JVM are available for almost every operating system. Java bytecode is executed by employing any operating system's JVM. Hence achieve port

Code, Ask question how to implement a decision tree in java #Minimum 100 wo...

Ask question how to implement a decision tree in java #Minimum 100 words accepted#

Write a program on clearing rectangles, Write a program on clearing Rectang...

Write a program on clearing Rectangles ? It is also potential to clear a rectangle that you've drawn. The syntax is exactly what you'd expect: public abstract void clearRect

What is arithmetic promotion assignment and casting, What is Arithmetic pro...

What is Arithmetic promotion assignment and casting? In an assignment statement, i.e. if there's an equals sign, Java compares the type of the left hand side to the at last typ

Write a java program to take data from excel files, Java program will be ta...

Java program will be take data from excel files (left diagram), and uses can be able to enter the input(middle diagram) in website when run the input the result appear in Pie 2D or

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