A number is divided into an array on average.

for example, change a number into an average array
, such as the number 8, and divide it into four times. When it cannot be evenly divided, the value of the first item of the array can be larger than that of the second term, and so on, for example, if it is divided into three parts, it becomes [3p3prit 2], and it is divided into five times.


this is a bit of a handshake. The basic idea is to use this number to evenly divide the number into modular operation and remainder operation. The items in the array are modular values, and then add one to each of the preceding (residual) items.


The

java code is as follows, which should be easy to convert to js

const split = (m, n) => [...Array(m%n).fill(m/n+1|0), ...Array(n-m%n).fill(m/n|0)]
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35a4a-2bfa2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35a4a-2bfa2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?