How to split a vector into n “almost equal” parts

后端 未结 7 644
野性不改
野性不改 2020-12-18 20:03

I have a problem that I would like to merge a large number of images using ImageMagick\'s convert.exe, but under Windows I have a 8192 byte long command line limit.

7条回答
  •  感情败类
    2020-12-18 20:51

    To get a base number for the size of each part, simply divide the total by the number of parts: 11/3 = 3. Obviously some of the parts will need to be bigger than that to get the proper total, but that's just the remainder: 11 % 3 = 2. So now you know that 2 of the parts will be size 3+1, and whatever's left over will be 3.

提交回复
热议问题