Given a box of ethernet cables with dimensions rows x columns, choose a xa groups for all a such that 1 < a < min(rows, columns). Determine the number of ways the box of cables can be divided. Example rows = 5 columns = 3 There are 3*5 = 15 ways to choose a 1 x 1 area of cables. There are 2 * 4 = 8 ways to choose a 2 x 2 area of cables. There are 1 *3 = 3 ways to choose a 3 x 3 area of cables. In total, there are 15 +8 +3=26 ways the box can be divided. Function Description Complete the function numberOfWays in the editor below. numberOfWays has the following parameter(s): int queries[n][2]: a 2D array of integers, each represents box dimensions (rows x columns) for a query Returns: int[n] = array of long integers where element / denotes the result of the test queries[i] Constraints • 1 ≤ number of test cases < 2500 • 1 rows, columns ≤ 2500

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 24PE
icon
Related questions
Question
Given a box of ethernet cables with dimensions rows x columns,
choose a xa groups for all a such that 1 < a < min(rows, columns).
Determine the number of ways the box of cables can be divided.
Example
rows = 5
columns = 3
There are 3*5 = 15 ways to choose a 1 x 1 area of cables.
There are 2 * 4 = 8 ways to choose a 2 x 2 area of cables.
There are 1 *3 = 3 ways to choose a 3 x 3 area of cables.
In total, there are 15 +8 +3=26 ways the box can be divided.
Function Description
Complete the function numberOfWays in the editor below.
numberOfWays has the following parameter(s):
int queries[n][2]: a 2D array of integers, each represents box
dimensions (rows x columns) for a query
Returns:
int[n] = array of long integers where element / denotes the result of
the test queries[i]
Constraints
• 1 ≤ number of test cases < 2500
•
1 rows, columns ≤ 2500
Transcribed Image Text:Given a box of ethernet cables with dimensions rows x columns, choose a xa groups for all a such that 1 < a < min(rows, columns). Determine the number of ways the box of cables can be divided. Example rows = 5 columns = 3 There are 3*5 = 15 ways to choose a 1 x 1 area of cables. There are 2 * 4 = 8 ways to choose a 2 x 2 area of cables. There are 1 *3 = 3 ways to choose a 3 x 3 area of cables. In total, there are 15 +8 +3=26 ways the box can be divided. Function Description Complete the function numberOfWays in the editor below. numberOfWays has the following parameter(s): int queries[n][2]: a 2D array of integers, each represents box dimensions (rows x columns) for a query Returns: int[n] = array of long integers where element / denotes the result of the test queries[i] Constraints • 1 ≤ number of test cases < 2500 • 1 rows, columns ≤ 2500
Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning