← 返回 google 的题目列表Equal Division of Square Area
类型:online_judge
Given a square, write a program to equally divide its area into n parts, where n is an integer. Provide the interface for the program, describing the input and output format, and implement the algorithm. Consider the input to be the side length of the square and the number of parts to divide into, and output the area of each part equally. Design the algorithm wisely and state the time and space complexity.
Input:
side_length (float): The side length of the square.
n (int): Number of parts to divide into.
Output:
(list of float): List of areas of each part.
Example:
Input: side_length = 4.0, n = 4
Output: [4.0, 4.0, 4.0, 4.0]
Constraints:
1 <= side_length <= 10^4
1 <= n <= 10^3
Example
Input
4.0 4