[過去ログ]
関数型プログラミング言語Haskell Part33 (1002レス)
関数型プログラミング言語Haskell Part33 http://mevius.5ch.net/test/read.cgi/tech/1581326256/
上
下
前次
1-
新
通常表示
512バイト分割
レス栞
抽出解除
必死チェッカー(本家)
(べ)
自ID
レス栞
あぼーん
このスレッドは過去ログ倉庫に格納されています。
次スレ検索
歴削→次スレ
栞削→次スレ
過去ログメニュー
702: デフォルトの名無しさん [sage] 2021/02/03(水) 14:08:13.61 ID:mxabq2OH 求めてないかもですがこんなふうならかけますね。 module Main where import qualified Data.Array.Unboxed as AU main = do print $ comb6 !! 2000 !! 1000 print $ comb7_1 !! 1000 !! 1000 print $ comb7_2 1000 1000 AU.! ( 1000, 1000 ) comb6 = ((1 : (repeat 0)) :) $ zipWith (zipWith (+)) comb6 (map (0 :) comb6) comb7_1 = (repeat 1 :) $ ([ 1 .. ] :) $ (map (\x -> scanl (+) 1 $ tail x) $ tail comb7_1) comb7_2 :: Int -> Int -> AU.Array ( Int, Int ) Integer comb7_2 ly lx = comb7_2_table where comb7_2_table = AU.array ( ( 0, 0 ), ( ly, lx ) ) $ concatMap(\i -> map (f i) [ 0 .. lx ]) [ 0 .. ly ] f 0 x = ( ( 0, x ), 1 ) f y 0 = ( ( y, 0 ), 1 ) f y x = ( ( y, x ) , comb7_2_table AU.! ( (y - 1), x ) + comb7_2_table AU.! ( y, (x - 1) )) http://mevius.5ch.net/test/read.cgi/tech/1581326256/702
メモ帳
(0/65535文字)
上
下
前次
1-
新
書
関
写
板
覧
索
設
栞
歴
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.055s