ToDo:
Haskell ¤Î²¿¤¬¥À¥á¤Ã¤Æ printf ¥Ç¥Ð¥Ã¥°¤Î¤·¤«¤¿¤¬ ¤ï¤«¤é¤Ê¤¤¤³¤È¤¸¤ã¤Ê¤¤¤«¤È¤³¤Ê¤¤¤À¹Í¤¨¤¿¡£ do ¤ÎÃæ¤Ê¤é´Êñ¤À¤±¤É¡¢ ´Ø¿ô¤ÎÃæ¤Ç¤³¤Î»þÃͤɤ¦¤Ê¤Ã¤Æ¤ë¤Î¡¼¡¢ ¤Ã¤Æ¤¤¤¦¤Î¤ÎÄ´¤Ù¤«¤¿¤¬¤µ¤Ã¤Ñ¤ê¤ï¤«¤é¤Ê¤¤¡£
¤È¤¤¤¦¤«Ä´¤Ù¤é¤ì¤ë¤Î¤«¡£ÌµÍý¤¸¤ã¤Ê¤¤¤Î¤«¡£
ËÍ¤Ï printf ¥Ç¥Ð¥Ã¥°¤¬¹¥¤¤Ç¹¥¤¤Ç¤·¤ç¤¦¤¬¤Ê¤¯¤Æ ¤È¤¤¤¦¤«Æ¬¼å¤¤¤«¤é¤« printf ¤òËä¤á¤Ê¤¤¤È ¥×¥í¥°¥é¥à¤òÍý²ò¤¹¤ë¤³¤È¤¬¤Ç¤¤Ê¤¤¡£
¤É¤Ã¤«¤Î¿Í¤Ë¤ª¤³¤é¤ì¤½¤¦¤À¤±¤É if ¤Î¸å¤Ë¤Ï´ðËÜŪ¤Ë { ½ñ¤¤¿¤¯¤Æ¡¢ ¤½¤ì¤Ï¸å¤«¤é if ¤ÎÃæ¤ËÆþ¤Ã¤Æ¤ë¤«¥Á¥§¥Ã¥¯¤¹¤ë¤¿¤á¤Ë printf ¤òËä¤á¤¿¤¤¤È¤¤¤¦¡¢¤½¤ì¤À¤±¤Î¤¿¤á¤Ç¡¢ ¤½¤·¤Æ¤½¤ì¤Ë²ÁÃͤ¬¤¢¤ë¤È¤¤¤¦¤«¡£ if ¤ÎÃæ¤È³°¤¬¤È¤Æ¤â´Êñ¤Ê¾ò·ï¤Ê¤é¤½¤ê¤ã { ¾Êά¤¹¤ë¤±¤É¡¢ ´ðËÜŪ¤Ë¤Ï¤¢¤Ã¤¿Êý¤¬¤¤¤¤¤È¤¤¤¦¤«¡£
ÅÓÃæ¤ÇÁ´Á³°ã¤¦ÏäˤʤäƤ¤¤ë¡£
(06:01)
¤¦¤Þ¤¹¤®¤ë¤Î¤Ç¥ì¥·¥Ô¥á¥â¡£ ˺¤ì¤ë¤ï¤±¤Ê¤¤µ¤¤â¤¹¤ë¤¬¡£ 99¤ÇÇã¤Ã¤¿Æ¦Éå¡¢ 99¤ÇÇã¤Ã¤¿¥¥à¥Á¡¢ 99¤ÇÇã¤Ã¤¿¤´¤ÞÌý¡¢ ¤¦¤Þ¤¤¤¿¤ì¡£
ŬÅö¤Ë¤«¤±¤ë¡£¥¥à¥Á¿¤á¡£¿©¤¹¤ë¡£¤ª¤ï¤ê¡£
(06:02)
http://d.hatena.ne.jp/mr_konn/20060605/1149520643
¤³¤ì¤ò½ñ¤¤¤Á¤ã¤¦ konn ¤µ¤ó¤¹¤²¡¼¤È»×¤¤¤Ä¤Ä¤â
c _ 0 = 1 c n r = (n-r+1) * (c n (r-1)) `div` r
ÉáÄ̤˽ñ¤±¤è¤È¤Ï»×¤Ã¤¿¡£
(06:33)
¤³¤ì¤Ç¥ª¥Ã¥±¤«¤Ê¡£
dfoldl f z x y = foldl (\a p -> f a (fst p) (snd p)) z (zip x y)
(06:41)
·×»»Î̤ǸÀ¤¦¤È¤³¤í¤Î¥¯¥é¥¹¤ß¤¿¤¤¤Ê´¶¤¸¤Ê¤ó¤À¤Ê¡£ ¤È¤¤¤¦¤«¿ô³Ø¤Ç¸À¤¦¤È¤³¤í¤Î¡¢¤«¡£
(06:53)
c _ 0 = 1 c n r | n > r*2 = (n-r+1) * (c n (r-1)) `div` r | otherwise = c n (n-r)
(07:13)
Á° | 2006ǯ 6·î |
¼¡ | ||||
Æü | ·î | ²Ð | ¿å | ÌÚ | ¶â | ÅÚ |
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 |
Á´¤Æ¥ê¥ó¥¯¥Õ¥ê¡¼¤Ç¤¹¡£ ¥³¡¼¥ÉÊҤϼ«Í³¤Ë»ÈÍѤ·¤Æ¤¤¤¿¤À¤¤¤Æ¹½¤¤¤Þ¤»¤ó¡£ ¤½¤Î¾¤Î¤â¤Î¤ÏGPL°·¤¤¤Ç¤¢¤ì¤Ð¤¢¤é¤æ¤ë»ÈÍѤ˴ؤ·¤Æʸ¶ç¤Ï¸À¤¤¤Þ¤»¤ó¡£ ¤Ê¤Ë¤«¤¢¤ì¤Ð²¼µ¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ø¡£
¤ª¤¸¤ã¤Þ¤·¤Þ¤¹¡£Debug.Trace¤¢¤¿¤êIO¤ÎÉÕ¤¤¤Æ¤Ê¤¤¤È¤³¤Ç¤â»È¤¨¤ë¤Ã¤Ý¤¤¤Ç¤¹¡£
¤ª¤ª¤¢¤ë¤«¤Ê¡¼¤È»×¤Ã¤Æ¤¿¤ó¤Ç¤¹¤¬¤½¤Î¤¯¤é¤¤¤Ï¤¢¤ë¤Î¤Ç¤¹¤Í¡£¤´¾Ò²ð¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£¤Á¤ç¤Ã¤È¤°¤°¤Ã¤Æ¤ß¤ë¤È»²¾ÈÆ©²áÀ¤È¤«¾Ã¤¨¤Æ¤ÆÌÌÇò¤«¤Ã¤¿¤Ç¤¹¡£
¤Ç¤¹¤¬ËÜÅö¤ËÍߤ·¤¤¤Î¤Ï¤Á¤ç¤Ã¤È¤·¤¿½èÍý¤òÆþ¤ì¤Æ¤·¤Þ¤¦¤³¤È¤À¤Ã¤¿¤ê¤·¤Æ¡¢¤Á¤ç¤Ã¤È»î¤·¤Ë¤³¤Î¾ì½ê¤Ç¶ë·ÁÉÁ²è¤·¤Æ¤ß¤¿¤¤¤Ê¡Ä¤È¤«¡¢¤³¤Î¾ì½ê¤Ç¤«¤«¤Ã¤¿»þ´ÖÄ´¤Ù¤¿¤¤¤Ê¤È¤¤¤¦»þ¤Ë global ÊÑ¿ôËä¤á¤Æ¤ß¤ë¤È¤«¤¬¤Ç¤¤Ê¤¤¤Î¤¬(¤³¤ì¤é¤â¤Ç¤¤¿¤ê¤¹¤ë¤«¤â¤·¤ì¤Þ¤»¤ó¤¬)¡¢Äˤ¤¤È¤«¤Ê¤ó¤È¤«¡£
Erlang ¤Ï¤Ê¤ó¤«¤è¤¯¤ï¤«¤é¤º¤¤¤¸¤Ã¤¿¤±¤ÉÃ༡Ū¤Ë½ñ¤±¤¿¤è¤¦¤Ë»×¤¨¤Æ¤³¤ì¤Ï¤Ê¤ó¤¸¤ã¤é¤Û¤¤¡¢¤È¤«¡£¤Þ¤¡¤è¤¯ÃΤ餺½ñ¤¤¤Æ¤ë¤À¤±¤Ê¤Î¤ÇÊÙ¶¯¤·¤Æ¤ß¤Þ¤¹¡£