project euler problem 22
まあ問題なし。 [1..]とzipをとる点がhaskellらしくて良い
import Data.List import Data.Char main=print $ sum $ zipWith score [1..] $ sort names score x y = x * (sum $ map code y) code x = ord x - ord 'A' + 1 names=["MARY","PATRICIA","LINDA"..略]
まあ問題なし。 [1..]とzipをとる点がhaskellらしくて良い
import Data.List import Data.Char main=print $ sum $ zipWith score [1..] $ sort names score x y = x * (sum $ map code y) code x = ord x - ord 'A' + 1 names=["MARY","PATRICIA","LINDA"..略]