2012-06-01ãã1ã¶æéã®è¨äºä¸è¦§
Problem 4æåã®ä¸ã¤ã ãã»ããã®ã§nextã¨ããé¢æ°ãèãã¾ããfilterã使ã£ã¦ã filter next() { $_ break } 1åå¤ãåãåã£ã¦ãããæåºãã¦ããã®ãã¨ãªãããã®æ¹æ³ã§ä¾å¤ãæãã¾ããããã§ã¯breakãã¦ãã¾ããããã§çµãã£ã¦ãããã§ããããã®ãã¨ã³â¦
Problem 4ãã®åé¡ã¯PriorityQueueã使ãã°ããèªç¶ã«æ¸ããã¨ãã§ãã¾ããPowerShellã§ã¯.NETã®ã³ã³ããã使ããã¨ãã§ãã¾ããSystem.CollectionsãããããªããPriorityQueueãç¡ããã§ããã ãããããªãã®ã§ä»£æ¿ãæ¢ãã¾ããããSortedListã使ãããâ¦
http://projecteuler.net/index.php?section=problems&id=390ä»æã¸ã§ã®ã³ã°ãã¦ããæãã¤ããããã£ãçµãã ã0.16ç§ã ã£ããç°¡åãªã¢ã¤ãã£ã¢ãªã®ã«ãªãæ©ãæãã¤ããªãã®ã ããã
http://projecteuler.net/index.php?section=problems&id=39040çã2æé以ä¸ããã¦ä¸æºåãã¦ããã使ã£ã¦0.36ç§ã
Problem 389ããã¯ç¢ºçè¨ç®ãããåé¡ãªã®ã§ããã¤ãã®ããã«æ¯é¢æ°ã®è¨ç®ããããã¨ã«ãªãã¾ããããããå¤é å¼ããªã¹ãã¨ãã¦è¨ç®ããã¨ãPythonã¯é常ã«é ããã§ãããããããªã¨ããNumPyã使ãã¨åçã«éããªãã¾ãããã¦ã³ãã¼ãã¯ãã®ãããããã htâ¦
Problem 4ä»åã¯åææ°ã®å¤å®ãè¡ãã¾ãããã®ããã«é åã®ä½¿ãæ¹ãè¦ãã¾ããabout_Arraysé åã¯æ¬¡ã®ããã«ä½æãã¾ãã $a = 3, 5, 7 $a[2] # 7 ããã§ãOKã§ãã $a = @(3, 5, 7) 次ã®ããã«ããã¨2次å é åã®ããã«ãªãã¾ãã $b = @(@(3, 4), @(5, 6)) â¦
Problem 3ãµã¤ãã«å帰ã使ãã¾ãã function last_prime($n, $p0 = 2) { for([long]$p = $p0; $p * $p -le $n; ++$p) { if($n % $p -eq 0) { return last_prime ($n / $p) $p } } $n } $n = 600851475143 last_prime $n ã©ããããã®æ·±ãã¾ã§OKãªã®ã§ãããâ¦
Problem 2ç§ä¸¸ã§ãã¯ããçµãã§ãã¦ãèµ°ãããã¨ã³ãã³ãããã³ãããç«ã¡ä¸ãã¦ãã®ãã¯ããèµ°ããããã¡ã¤ã«ã®ãã£ã¬ã¯ããªã«ç§»åããããã«ãã¦ããã®ã§ãããããã§powershellã¨æã¤ã¨ãã¹ã¿ã¼ãã¡ãã¥ã¼ããPowerShellãç«ã¡ä¸ãããã楽ã§ããã å ¥åâ¦
http://projecteuler.net/index.php?section=problems&id=38959çã ç´ ç´ã«æ¸ãã ãã®åé¡ãã§ããPythonã ã¨ãã®æã®ã³ã¼ãã¯é ãã®ã§ãæå¾ã«ä¸å·¥å¤«ãã¡ãã£ã¨æ°å¦ã使ãã
Problem 1ãã®åé¡ã¯Pythonã§ã¯ããæ¸ãã®ãæ®éã ã¨æãã¾ãã N = 1000 print sum(n for n in xrange(1, N) if n % 3 == 0 or n % 5 == 0) ããã«è¿ãæ¸ãæ¹ãèãã¾ãããã Measure-Object åãåãã«ã¯Measure-Objectã使ãã¾ãã 1..999 | Measure-Objâ¦
Problem 1å é¤åçã使ãã®ã¯ããã¦ãæ¬æ¥ã®æ¸ãæ¹ã§ã¯ãªãã®ã§ããã«ã¼ãã使ãã¾ãããã while $n = 1000 $s = 0 $k = 1 while($k -lt $n) { if($k % 3 -eq 0 -or $k % 5 -eq 0) { $s += $k } $k += 1 } $s whileã¯Cã¨ã ãããåãã§ãããã ãæ¯è¼æ¼ç®åâ¦
http://projecteuler.net/index.php?section=problems&id=38888çãçµå±ã¶ãåãã¦ã
Problem 1ååããã¡ããProblem 1ã解ãã¾ããããåããããªã³ã¼ãã並ãã§ããã®ã§ããããé¢æ°åãã¾ãããã function f($n, $d) { [int]$m = [math]::floor(($n - 1) / $d) $m * ($m + 1) / 2 * $d } $n = 1000 (f $n 3) + (f $n 5) - (f $n 15) ããâ¦
Problem 1ãã£ããProblem 1ã解ãã¦ããã¾ãããã ãã®åé¡ã解ãæãç°¡åãªæ¹æ³ã¯ãå é¤åçã使ããã¨ã§ããããããªãã¡ã3ã®åæ°ã®åã¨5ã®åæ°ã®åã足ãã¦ã15ã®åæ°ã®åãå¼ãã¾ããã¾ãã1000ãå¤æ°ã«ä»£å ¥ãã¾ãã > $n = 1000å¤æ°ã«ã¯é ã«$ãã¤ãâ¦
Windows PowerShellã¯å¾æ¥ã®ã³ãã³ãããã³ããã®ä»£æ¿ã§ãããããã便å©ã«ãªã£ã¦ãã¦ãã¹ã¯ãªãããããããã¡ã¤ã«ããã¯ããªãã¾ã¨ããªè¨èªã«ãªã£ã¦ããããã§ããä¾ã«ãã£ã¦Project Eulerã®åé¡ã解ããªãããã®è¨èªãå¦ãã§ããã¾ãããã ã¾ããWindowsâ¦
http://projecteuler.net/index.php?section=problems&id=388æ¨æ¥ããèãã¦ãããã©ãã§ãããã§ã§ããªãã
æ¨æ¥ã¯cos20°ãæ±ãã¾ããããä»æ¥ã¯â2ãæ±ãã¾ãã100ä¸æ¡ãç®æ¨ã«ãã¾ãããã ânã®å¾ªç°é£åæ°ã«ãªãã¾ããâ2ã¯ã â2 - 1 = 1 / (2 + 1 / (2 + ...)) = [ 0; 2, 2, ... ] ã¨ãªãã¾ããé£åæ°ãéä¸ã§æã¡åã£ãã¨ãã®åæ°ãan / bnã¨ç½®ãã¨ã an+2 = 2an+1â¦
æ°å¦ã¬ã¼ã«/ã¬ãã¢çè« (æ°å¦ã¬ã¼ã«ã·ãªã¼ãº 5)ä½è : çµå浩åºç社/ã¡ã¼ã«ã¼: SBã¯ãªã¨ã¤ãã£ãçºå£²æ¥: 2012/05/30ã¡ãã£ã¢: åè¡æ¬è³¼å ¥: 8人 ã¯ãªãã¯: 310åãã®ååãå«ãããã° (57件) ãè¦ãæ¨æ¥ããèªãã§ãããP.164ã«ã cos ãæ±ããè¨ç®æ©ã使ãã°â¦
æªè§£æ±ºåé¡ã解ããã·ãªã¼ãºç¬¬3å¼¾ãhttp://projecteuler.net/index.php?section=problems&id=356235çã
http://projecteuler.net/index.php?section=problems&id=38748çã æ ã¦ã¦ãã¿ãã¿ã¨ãè½ã¡çãã¦æ¸ãã°ããã¡ãã£ã¨æ©ã解ãããã ãããã©ã
æªè§£æ±ºåé¡ã解ããã·ãªã¼ãºç¬¬2å¼¾ãhttp://projecteuler.net/index.php?section=problems&id=326265çã ãã®åé¡ãåºé¡ãããã¨ããªã«ãæ©ãã§ãããã¯ä»ã¨ãªã£ã¦ã¯ããããªãã
http://projecteuler.net/index.php?section=problems&id=324300çã