#K90672. Apartment Dimensions Maximization
Apartment Dimensions Maximization
Apartment Dimensions Maximization
In this problem, you are required to implement two functions: one to compute all the factors of a given integer n, and another to determine the dimensions of an apartment block that maximize the number of rooms. The first function, get_factors(n), should return all positive factors of n. The second function, max_rooms_dimensions(H, W), should compute and return a pair (a, b) where a is the maximum factor of H and b is the maximum factor of W. Here, the maximum factor of any positive integer is always the integer itself, but for the sake of the problem, you must compute the factors and determine the maximum from them. All formulas (if any) must be in LaTeX format. Your program should read input from standard input (stdin) and output the result to standard output (stdout).
inputFormat
The input consists of two lines.\n\n- The first line contains a single integer , for which you have to compute all factors using the function (get_factors(n)).\n- The second line contains two space-separated integers and , representing the dimensions of an apartment block. You need to compute the dimensions that maximize the number of rooms using the function (max_rooms_dimensions(H, W)).
outputFormat
The output should consist of two lines.\n\n- The first line should list all factors of in increasing order, separated by a space.\n- The second line should display the two numbers (the maximum factors of and respectively) separated by a space.## sample
1
12 18
1
12 18
</p>