2009-01-01ãã1ã¶æéã®è¨äºä¸è¦§
http://projecteuler.net/index.php?section=problems&id=186 ä¹ ã ã®project euler. UnionFind,DisjointSetãç¥ã£ã¦ããã°ç°¡åï¼ åé¡ã¯ï¼ã©ãé¢æ°åè¨èªã§å®è£ ãããï¼ã§ãã(ç¬)ï¼ {-# LANGUAGE BangPatterns #-} import Control.Monad.ST (ST,runST) impoâ¦
http://www.tatari-sakamoto.jp/skkime.jis.html ãã skkime1.5-winxp-bin-snap20081107.tar.gz ãé ãï¼ SKKI1_5U_WXP.INF ãå³ã¯ãªãã¯ãã¦ï¼ãã¤ã³ã¹ãã¼ã«ããé¸æï¼ ãã¨ã¯åæã«é²ãã æ°ãããï¼ è¾æ¸ã http://openlab.ring.gr.jp/skk/wiki/wiki.cgiâ¦
emacs 22.3 ã windows ã«ã¤ã³ã¹ãã¼ã«ããï¼ MS-IMEã¯ä½¿ããªãã®ã§ï¼ããã§è¯ãï¼ ããããã£ã¦ï¼ apel skk color-theme fixed-width-fontset redo ãå ¥ããï¼ ã¨ããããã®è¨å®â ;;; -*- Mode: Emacs-Lisp ; coding: iso-2022-jp-unix -*-;;; ;;; Time-staâ¦
ã¡ãã£ã¨ä½¿ã£ã¦ã¿ãï¼è¯ãããã ï¼ skkimeãå ¥ãã¦ã¿ããï¼ http://www.tatari-sakamoto.jp/skkime.jis.html http://mayokara.info/blog/archives/2008/02/24190204.php 1.5ãããã¦ã¿ãï¼ SKKI1_5U_WXP.INF ã§ã¤ã³ã¹ãã¼ã«ï¼å³ä¸ã®ãã¼ãã¼ãã¢ã¤ã³ã³ã§MS Iâ¦
gs ã使ã£ã¦ windows㧠gswin32c -q -sDEVICE=epswrite -sOutputFile=foo.eps -r9600 -dNOPAUSE -dBATCH -dSAFER -dEPSCrop foo.ps æå³ã¯ããå²ãããï¼epsãã¡ã¤ã«ãã§ããã®ã§ããã¨ããï¼ pstoeditã使ã£ã¦ pstoedit -f plot-svg foo.eps foo.svg ãããâ¦
http://projecteuler.net/index.php?section=problems&id=184 ä¸è§å½¢ãé ç¹ã§ã¯ãªããé ç¹ã¨åç¹ãçµã¶ç´ç·ã§èããã import Data.Function (on) import Data.Map (fromListWith,toList) choose :: [a] -> Int -> [[a]] choose _ 0 = [[]] choose [] _ = []â¦
http://projecteuler.net/index.php?section=problems&id=183logã¨ã£ã¦å¾®åããã del :: Integral a => a -> a -> a del p = until ((0/=).(`mod` p)) (`div` p) d ::Integral a => a -> a d n | (1==).del 5.del 2.div r' $ (gcd n r') = -n | otherwise =â¦
http://projecteuler.net/index.php?section=problems&id=182 p182 p q = sum [e | e <-[2..phi-1], gcd e phi == 1, gcd (e-1) (p-1) == 2, gcd (e-1) (q-1) == 2] where phi = (p-1)*(q-1) main = print $ p182 1009 3643 {-- g(e,p) = x^e=x (mod p) ã®è§£â¦
http://projecteuler.net/index.php?section=problems&id=181 import Data.Array (range) import Data.Array.IO (IOArray,newArray,readArray,writeArray) import Control.Monad (forM_) b = 60;w = 40 main = do g <- newArray ((0,0),(b,w)) 0 :: IO (IOArâ¦
http://projecteuler.net/index.php?section=problems&id=180 å¼å¤å½¢ãããã¯ããã¯nã®ç¯å²ãæçã§ãªãã¦ãæ¸æã£ããããã§ã«ãã¼ã®å®çã ã£ãã import Control.Monad (guard,liftM) import Data.Ratio (denominator,numerator,(%)) import Data.Set (froâ¦
http://projecteuler.net/index.php?section=problems&id=214 åã«Haskellã§ææ¦ãã¦ãã©ããé ãã¦è§£ããªãã£ããã Problem 179ã解ãã¦ããµããã使ãã°å¹çããΦé¢æ°ãè¨ç®ã§ãããã¨ã«æ°ãã¤ããã æç¶ãåã®ã»ããæ¸ããããããªã®ã§javaã§ã public â¦
http://projecteuler.net/index.php?section=problems&id=179 ããã¦ãã®å ´åãç´ å æ°å解ã¯éãã ã¨ã©ãã¹ããã¹ã®ãµããã¨DPãçµã¿åããããããªã¢ã«ã´ãªãºã ã åç´ãªç¹°ãè¿ãã§ããããCã®ã³ã¼ãã #include <stdio.h> #define LIM 10000001 #define SQR 3163 i</stdio.h>â¦
http://projecteuler.net/index.php?section=problems&id=178 ç¶æ ã§èããã¨ç¶æ ã¯ä»ã¾ã§ã®æå°æ°åãæ大æ°åãæå¾ã®æ°åã§è¡¨ç¾ã§ããã ç¶æ æ°ã¯é«ã 10^3ã import Data.Map (Map,unionWith,filterWithKey,mapKeysWith,fold,fromList) type State = (Intâ¦
http://projecteuler.net/index.php?section=problems&id=177 対称æ§ã®ãã§ãã¯ã大å¤ã ç´ ç´ãªå ¨æ¢ç´¢ãªã®ã§javaã«ããã è³¢ãæ¢ç´¢ãããã¿ããã ãããã¯ã対称æ§ã®é¤å¤ãé¢åããã public class P177{ public static void main(String[] args){ int countâ¦
http://projecteuler.net/index.php?section=problems&id=176 å æ°å解 ãã ã¨ãªã ã¨ãã㨠ã ãã (p,q)ã®çµã®æ°ãèããã°ãããï¼ãã ããp,qã¯2ã®åæ°) import Number p176 = (2*).product.zipWith (^) primes.reverse.map (`div` 2).factors.(+1).(2*)â¦
http://projecteuler.net/index.php?section=problems&id=175 åã«ä¼¼ããããªåé¡ããã£ãã çµè«ããããã¨ã¦ã¼ã¯ãªããã®äºé¤æ³ã®ãããªãã® import Data.List step :: Integral a => (a,a) -> Maybe (a,(a,a)) step (p,q) | q == 0 = Nothing | p <= q = â¦
ä»æ¥ã¯ä¸å¹´åãããè±èªãèãã¦ãä¸å¹´åããã話ããæ°ããããªã¼ã ã¨ãããããä»å¾æ¥æ¬ã®å¤ã«åºã¦è¡ããªããããå°ãè±èªè©±ããããã«ãªã£ãã»ããè¯ããã ã¨ããã¨ãçæãã¾ããã
http://projecteuler.net/index.php?section=problems&id=174 ã¾ããããããã£ãã¨å¤§ãã¦å¤ãããªãï¼ã¨æãããã£ã¨è¯ã解æ³ãããããï¼ã import Data.List import Data.Array.IO n :: Integer n = 10^6 lamina :: Integer -> [Integer] lamina h = [l^2â¦
http://projecteuler.net/index.php?section=problems&id=173 åçè ãå¤ãã ããã£ã¦ç°¡åã lamina :: Integer -> Integer lamina n = (sum.map (div n)) [4,8..4*m] - div (m*(m+1)) 2 where m = floor.sqrt.fromInteger.div n $ 4 p173 = lamina $ 10^6
http://projecteuler.net/index.php?section=problems&id=171 æ°åã®åºã¦ããé çªã¯æ¬è³ªçã§ã¯ãªãã å¹³æ¹æ°ã1^2,2^2,3^2,..9^2ã使ã£ã¦åå²ã ãã®åå²ããã§ããæ°åã®åãèããï¼permutationsï¼ã ç·åãã¨ãã digit :: Int digit = 20 partitionToSquâ¦
http://projecteuler.net/index.php?section=problems&id=172 æµãã¯ååã¨ä¼¼ã¦ããã ã¾ããåå²ãã¦ããã®åºç¾åæ°ãæ°ããåãã¨ãã ä¹ ã ã«ä¸ç¬ã§èµ°ãã import Data.List divid :: Int -> Int -> Int -> [[Int]] divid 0 _ k = [replicate k 0] divid xâ¦
http://projecteuler.net/index.php?section=problems&id=170 å¿ããã¨ããã¤ã¤ãã åéã«ãã£ã¦ãã ãã ããã¨è¨ã訳ã æ大ãæ¢ãã®ã§ã9876543210ããéè¾æ¸å¼é ã«æ¢ç´¢ã æåã®æ°ã¯3ã®åæ°ã§50æªæºã ã¨åãããï¼10æ¡å¶ç´ï¼ å¤åã解ã¯98????????ã®å½¢ãâ¦
ãªãã ããå¿ããã§ãã
http://projecteuler.net/index.php?section=problems&id=169 2ã®ç´¯ä¹ãåºã¦ãããã2é²æ°ã§èããããªãã®ã人æ ã å°ã観å¯ããã¨ã2ãä¼æãã¦ãããæããã¤ã¾ããæå¾ã2ããããã§ãªããã§ç¶æ³ãå¤ããã ã§ãããããã£ãçµæãæçµçã«æ¬¡ã®ããã«èâ¦
http://projecteuler.net/index.php?section=problems&id=168 å é ã®æ°åã¨ç´æ°ã決ããã¨æ¬¡ã ã¨å¾ã®æ°åãåãã£ã¦ããã ãããã¾ãã循ç°ãå©ç¨ã import Data.List expand d hd = (div hd d:).unfoldr f.snd.g $ hd where f x | x == hd = Nothing | othâ¦
http://projecteuler.net/index.php?section=problems&id=167 å¶æ°é ãï¼ã¤ãããããããªããã¨ããäºå®ãå©ç¨ã 循ç°ãèããã ã¡ã¢ãªã足ããªããªã£ãã®ã§ãSTãå©ç¨ã ããããã¾ããã³ã¼ããããããããªãã§ããã ããããçµå± $ ./p167.exe Stack sâ¦
ãã1æã5æ¥ã§ãããæ£æåã¯ãã£ããä½ããã¦ãããã ï¼
ä»æ¥ãã¤ã¯ã«ï¼¤ï¼¨ãã¼ãåè£ çããã ãã¼ãã¼ãã¯ããããããçµæ§é¢åã ã£ãã ãããããã®ãã¤ã¯ã«æ¬¡ä¹ãã®ã¯ãã¤ã ãããï¼ãªãã¦æã£ã¦ãã¾ãã éåä¸è¶³ã ããã©ãèãã¦ãã
http://projecteuler.net/index.php?section=problems&id=166éæ¹é£ã®ãããªåé¡(åãæ°åãä½åº¦åºã¦ããã¾ããªãï¼ brute force ã§ãã§ããããããã§ã¯é¢ç½ããªãã ã¨ãããããæ°åãmod 2 ãã¦èããã¨èªæ解ã®ã»ãã« 1 0 0 0 0 0 1 0 0 0 0 1 0 1 0 0 â¦
http://projecteuler.net/index.php?section=problems&id=165 ãã®åé¡ã¯çµæ§è¦å´ããã ç·å交差åæåé¡ ã¨ãã£ããå¹³é¢èµ°æ»æ³ã¨ããããå®è£ ãããã¨è©¦ã¿ãï¼åããå®è£ ãã¦ã¿ããã¨ã¯æã£ã¦ããï¼ã⦠ç¡ç ä¾å¤å¦çãäºæ³ä»¥ä¸ã«å¤§å¤ã ãå¦çããªãã¦ã¯ãâ¦