You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
è¿æ³ æã¡æ¨ã¦ãããéå»ã«ã¤ã㦠è¦æ¨ ãã®è¨äºãèå³æ·±ãèªãä¸æ¹ã§ããã¯ãéåæãè¦ãã人ãå¤ãããããã§ãèªåããã®ä¸äººã ã£ããæããããã®éåæã¯ããæ½è±¡åãããå ·ä½æ§ã奪åãã¦ãããã®ãã¨ãã£ããããªå¯¾ç«é ã¨ãã¦è¿°ã¹ããã¦ããããã ãã¨ããããã«æããããããããæããã¦å ·ä½æ§ç¡ãã«ãæ½è±¡åããããã¨ãæçãªãã¨ãªã®ã ãããããããä¸ã¤ã®éåæã®ããã«æãããã æ¬æ ããã°ã©ãã³ã°ã®ä¸çã«ã¯ãYAGNIåå(You ain't gonna need it)ã¨ãããã®ããããã¾ããYAGNIã¨ããè¨èã使ããªãã¦ãããé度ãªæ±ç¨åã足ãå¼ã£å¼µã失æä¾ãã¨ããã®ã¯ãããã°ã©ãã¨ãã¦ã®å¿æ§ããæ¸ããæ¬ã®ä¸ã§ãã¡ãã»ãã¨èªå²æ°å³ã«è¿°ã¹ããããã¨ãããã åããä¸åº¦ãã®ãããªå¤±æä¾ãè¦ããã¨ãããããã©ããªããããã失æãèµ·ããã®ãã確ãã«ãã¶ã¤ã³ãã¿ã¼ã³ã§çµã¿ç«ã¦ãããã¢ã¼ããã¯ãã£ã¯ã
å§ãã« FizzBuzzæ好家ã®çããããã«ã¡ã¯ãéè¯FizzBuzzç 究家ã®ä¼¼éåã§ãã FizzBuzzç 究ã¨ããã®ã¯æ§ã ãªã¸ã£ã³ã«ãããã¾ã[è¦åºå ¸]ãä¾ãã°ãã©ãã ãã³ã¼ããçãæ¸ãããã«æ³¨åããCodeGolfæ´¾ããã¾ãããä¸æ¹ã§ãã¾ãã¾ãªFizzBuzzãæ¸ãã¦åã³ã¨ãã¦ããä¸æ´¾ãããããããèªåã ã£ãããã¾ã(確èªããã¨ãããèªåä¸äººã§ã)ãFizzBuzzã«ã¤ãã¦ã¯ããããã¨ãã説æããå¿ è¦ããªããã¨ã¯æãã¾ãããããç¥ããªã人ã¯ãé©å½ã«Googleããªã«ãã§æ¤ç´¢ãã¦ãããã¨ãããããã§ãã ä¸ç´FizzBuzzerã®åºæ¬æé¤: ifç¦æ¢ ã¾ãæåã«ãFizzBuzzã®åºç¤æé¤ã¨ãã¦ââã¤ã¾ããFizzBuzzåå¿è ããFizzBuzzä¸ç´è ã«ãªãå ´åã«ããã¦ââã¾ãifã使ããã«ãã©ãåå²ã表ç¾ããã®ããã¨ããã®ãããã§ããããä¾ãã°Rubyã«ããã¦ãifã使ããã«Fiz
æçµé¬¼çFizzBuzzå¤§å ¨ - Qiitaã«åºæ¿ãåãã¦ãQiitaã®ã»ãã«ãã¹ããã¦ã¿ããã ãã©ããã¡ãã¯è§£èª¬ä»ãã§ã RubyçFizzBuzz - ãã®ï¼ class FB def FizzBuzz(n) (n%15)==0 end def Fizz(n) (n%3)==0 end def Buzz(n) (n%5)==0 end def self.call(n) instance_methods(false).detect { |m| new.send(m, n) } || n end end (1..100).each { |i| printf "%s ", FB.call(i) } # >> 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz Fizz 22 23 Fizz
PHPã«ã³ãã¡ã¬ã³ã¹é¢è¥¿2014ã§ãPHPã³ã¼ãã§ã¯ãªãPHPã³ã¼ãã®ãæ¸ãæ¹ããç¥ãããçºè¡¨ãã¦ãã¾ããã åçæä¾ï¼ä¹ 岡åçäºåæ å¥ãã©ãã¯ã«äººæ°ã»ãã·ã§ã³ãã²ãããä¸ãå¤ãã®æ¹ã«è´ãã¦é ãããããã¨ããããã¾ããm(_ _)m çºè¡¨å 容 PHP ä¸ç´è ï¼ä¸ç´ãã©ããã¨ããã®ã¯ããã¾ããï¼ãç®æãåå¿è ã®æ¹ã対象ã«ãFizzBuzz ã®ã³ã¼ãããé¢æ°ã«ã¾ã¨ãã¦ãã¯ã©ã¹åããã¨ããã®ãã©ã¤ãã³ã¼ãã£ã³ã°ã§è¡ãã¾ããã ã¾ããé¢æ°ã«ã¾ã¨ãã段éã§ãèªåãã¹ããæ¸ãã¦ãå®è¡çµæãç®ã§ç¢ºèªããã®ã§ã¯ãªãããã¹ããå®è¡ãã¦ç¢ºèªããã¨ããã¹ã¿ã¤ã«ãåãã¾ããã çºè¡¨è³æã¯ä»¥ä¸ã§ãã ã³ã¼ããæ¸ããªããé²ãã¦ããå½¢ãªã®ã§ãè³æã ãã§ã¯å°ãä¼ãããªãé¨åãããããããã¾ããã ãã¢ã§æ¸ãã PHP ã³ã¼ãã¯ãGitHub ã§å ¬éãã¦ãã¾ããSample1, Sample2 ã¨ãã£ã¬ã¯ããªãåããã¦ã
CodeIQä¸ã®äººãmillionsmileã§ãã PHPã¡ã³ã¿ã¼ãºã®å¾è¤ç§å®£ããåºé¡ã®ããªãã¸ã§ã¯ãæåçFizzBuzzãåé¡ã®è§£èª¬è¨äºã§ãï¼ PHPã¯ãéçºè¨èªå¥ã®æ±äººæ°ã©ã³ãã³ã°ã§2ä½ã§ããã¾ãï¼åºå ¸ï¼ãããã«ã¯ãPHPãæ¸ãã¦ãªãã¸ã§ã¯ãæåããããã¨ã³ã¸ãã¢ã¸ã®ä¼æ¥ãã¼ãºã¯é«ããã®ã®ãå®éã¯ãã¾ã ã¾ã 層ãèãã¨ãããã¨ããããä»åã®åºé¡ã¸ãã¨ãªãã¾ããã ãã²è§£èª¬è¨äºãèªãã§ãã¤ã±ã¦ããªãã¸ã§ã¯ãæåããããPHPã¨ã³ã¸ãã¢ããããã¦ã¿ã¦ã¯ã©ãã§ãããã 以ä¸ãåé¡æã§ãã FizzBuzzåé¡ã解ãã¢ããªã±ã¼ã·ã§ã³ãå®è£ ãã¦ããã¨ãã¾ãã â FizzBuzzåé¡ã¨ã¯ï¼ 1, 2, 3, ã»ã»ã»ã¨ããå ¥åã«å¯¾ãã¦3ã§å²ãåããå ´åã¯ãfizzãã5ã§å²ãåããå ´åã¯ãbuzzã 3ã§ã5ã§ãå²ãåããå ´åã¯ãfizzbuzzãããã以å¤ã¯æ°å¤ããã®ã¾ã¾åºåãã PHPã³ã¼ãã¯æ¬¡
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}