我需要帮助才能将一个未知整数分成给定数量的偶数部分——或者至少尽可能均匀。各部分之和应为原始值,但各部分应为整数,且应尽可能接近。
Parameters
num: Integer - The number that should be split into equal parts
parts: Integer - The number of parts that the number should be split
into
Return Value
List (of Integers) - A list of parts, with each index representing the part and the number contained within it representing the size of the part. The parts will be ordered from smallest to largest.
Run Code Online (Sandbox Code Playgroud)
这就是我所拥有的
Parameters
num: Integer - The number that should be split into equal parts
parts: …
Run Code Online (Sandbox Code Playgroud)