Created
          March 23, 2015 15:02 
        
      - 
      
- 
        Save jooyunghan/c5479440a567271cfe1d to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | -- euler67 | |
| -- input file: https://projecteuler.net/project/resources/p067_triangle.txt | |
| readInput = map (map read . words) . lines | |
| solve = foldr1 merge | |
| where merge xs ys = zipWith (+) xs $ zipWith max ys (tail ys) | |
| main = do | |
| content <- readFile "p067_triangle.txt" | |
| --content <- return "3\n7 4\n2 4 6\n8 5 9 3" | |
| putStrLn $ show $ solve $ readInput content | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment