整数分割の方法のアルゴリズム、
- The first integer partition of n is (最初のパーティションは )
- B consists only 1’s, then done(パーティションが1のみで構成されたなら終了)
- there is a smallest non-1 part (リストのうち1以外の最小数を と置く)
- subtract 1 from (から1を引く)
- collect all the units so as to much the new smallest part (残りの要素すべてを最大でとなるようすべて集める)
最後がかなり怪しい訳になった。このアルゴリズの例が、
The partition after [1, 1, 3, 3] is [1, 2, 2, 3], for after subtracting 1 from 3, we should pack the three units that result in parcels of size 2. The partition after [1, 1, 1, 1, 1, 1, 5] is [3, 4, 4], for after subtracting 1 from 5, we should pack the seven units that result in parcels with maximum size 4, which gives three units and one parcel of size 4, which in turn gives one parcel of size 3 and one of size 4. The partition after [3, 3, 5] is [1, 2, 3, 5]. The partition after [1, 3, 3, 4] is [2, 2, 3, 4].
これ。理解できてないのでコードが書けん。