âå ¨è¦ç´ ã®ã¤ãã¬ã¼ã¿ã欲ããå ´åï¼import itertoolsï¼ ç´ç©ï¼ãã«ã«ãç©ï¼ï¼itertools.product ä¾ï¼ list(itertools.product([âaâ, âbâ, âcâ, âdâ, âeâ], repeat=2)) #= itertools.product([âaâ, âbâ, âcâ, âdâ, âeâ], [âaâ, âbâ, âcâ, âdâ, âeâ]) [(âaâ, âaâ), (âaâ, âbâ), (âaâ, âcâ), (âaâ, âdâ), (âaâ, âeâ), (âbâ, âaâ), (âbâ, âbâ), (âbâ, âcâ), (âbâ, âdâ), (âbâ, âeâ), (âcâ, âaâ), (âcâ, âbâ), (âcâ, âcâ), (âcâ, âdâ), (âcâ, âeâ), (âdâ, âaâ), (âdâ,
Google ã®ã¦ã§ããã°å ¬éãã¼ã«ã使ã£ã¦ãããã¹ããåçãåç»ãå ±æã§ãã¾ãã
>>> import Data.List >>> permutations [1,2,3] [[1,2,3],[2,1,3],[3,2,1],[2,3,1],[3,1,2],[1,3,2]] comb :: Int -> [a] -> [[a]] comb 0 xs = [[]] comb _ [] = [] comb n (x:xs) = [x:y | y <- comb (n-1) xs] ++ comb n xs >>> import Control.Monad >>> replicateM 5 ["a", "b", "c"] [["a","a","a","a","a"],["a","a","a","a","b"],["a","a","a","a","c"],["a","a","a","b","a"],["a","a","a","b","b"],["a","a","a","b","c
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}