Add tags

Add tags to the following comment
今度は大丈夫かな。
現在手元にまともなマシンがないので実行時間は後日。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import List

main = putStr $ unlines $ map (unlines . map (bou!!))
  $ partitions 50 where
  bou = iterate ("[]"++) ""

partitions n = [1..n] >>= partitions' n  where
  partitions' n m = map (map sum.transpose.(:[ones]))
    $ f (n-m) m (n-m)  where ones = replicate m 1
  f _ 0 _ = [[]]
  f n m p = [x:xs| let p' = min n p, x <- [p',p'-1..(n+m-1)`div`m], xs <- f (n-x) (m-1) x]

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...