[1..100]>>=pen #4586(2007/12/03 10:50 GMT) [ Haskell ] Rating3/3=1.00
また間違えた。orz orz (正しい答えを出してたけど意図したコードではなかった) 今度こそ。 Windows XP システムのプロパティ Pentium(R) 4 CPU 2.40GHz 2.41 GHz, 0.99 GB RAM ghc -O3 (GHC6.8.1) ファイルにリダイレクトで5秒くらい。
1 2 3 4 5 6 7 8
main = putStr $ unlines $ map (unlines . map (bou!!)) $ partitions 50 where bou = iterate ("[]"++) "" partitions n = [1..n] >>= f n n where f n p m | n <= m = [replicate m 1] | otherwise = [x:xs| let p' = min (n-m+1) p, x <- [p',p'-1..(n+m-1)`div`m], xs <- f (n-x) x (m-1)]
Rating3/3=1.00-0+
1 reply [ reply ]
[1..100]>>=pen
#4586()
[
Haskell
]
Rating3/3=1.00
Rating3/3=1.00-0+