[1..100]>>=pen #4546(2007/12/01 17:35 GMT) [ Haskell ] Rating1/1=1.00
今度は大丈夫かな。 現在手元にまともなマシンがないので実行時間は後日。
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]
Rating1/1=1.00-0+
2 replies [ reply ]
[1..100]>>=pen
#4546()
[
Haskell
]
Rating1/1=1.00
Rating1/1=1.00-0+
2 replies [ reply ]