2010-10-01から1ヶ月間の記事一覧
nからはじまるrests.total個の要素を rests[0]個,rests[1]個,…,rests[n]個に分ける全ての分割の仕方を生成する [ Array::totalの本体は self.inject(0){|x,y| x+y } と定義されてるつもり ] def split_sequence(n,rests,groups=Array.new(rests.length){ [] …
0/0も含めて割り算が定義された代数があるらしい WikipediaのWheel Theory