Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given a rectangle with dimensions N'M and an integer K. You divide this rectangle into smaller sub-rectangles such that the given conditions are satisfied: Sub-rectangles

Given a rectangle with dimensions N'M and an integer K. You divide this rectangle into smaller sub-rectangles such that the given conditions are satisfied:

Sub-rectangles must be parallel to the axis of the larger rectangle with dimensions N'M

Every sub-rectangle has at least one edge on the larger rectangle edge. Informally, there is no sub-rectangle that is surrounded by other sub-rectangles.

For a sub-rectangle with area S, the cost of this sub-rectangle is (S-K)2

Calculate the minimum total cost to divide the larger rectangle into smaller sub-rectangles.

Note: All sub-rectangles must have an integral length of dimensions.

Function description

Complete the solve function. This function takes the following 3 parameters and returns the required answer:

N: Represents the value of N

M. Represents the value of M

K: Represents the value of K

image text in transcribed

image text in transcribed

write the code in Java 8.

Create rectangles Given a rectangle with dimensions N'M and an Integer K. You divid this rectangle into smaller sub rectangles such that the given conditions are satisfied: - Sub-rectangles must be parallel to the axis of the larger rectangle with dimensions NM. - Every sub-rectangle has at least one edge on the larger rectangle edge. Informally, there is no sub-rectangle that is surrounded by other sub-rectangles. For a sub-rectangle with area S, the cost of this sub-rectangle is (SK)2. Calculate the minimum total cost to divide the larger rectangle into smaller sub-rectangles. Note: All sub-rectangles must have an integral length of dimension Function description Complete the solve function. This function takes the following 3 parameters and returns the required answer: - N: Represents the value of N - M Represents the value of M - K: Represents the value of K Input format for custom testing Input format for custom resting Note: Use this input format if you are testing against custom input or writing code in a language where we don't provide boilerplate code. - The first line contains I, which represents the number of test cases. - For each test case: - The first line contains an integer N. - The second line contains an integer M. - The third line contains an integer K. Output format For each test case in a new line, print the answer representing the minimum cost. Constraints 1T51N,M3001K104

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Contemporary Issues In Database Design And Information Systems Development

Authors: Keng Siau

1st Edition

1599042894, 978-1599042893

Students also viewed these Databases questions