Advertisement
Guest User

Untitled

a guest
Apr 27th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import System.IO
  2. loadList :: Handle -> IO[(String, Int)]
  3. loadList handle = do
  4.     contents <- hGetContents handle
  5.     let allLines = lines contents
  6.     let lines = init(tail allLines)
  7.     let rez = zip (concat[take 1 (words line) | line <- lines]) [((((read y::Int)*100)+(read m::Int))*100)+(read d::Int) | [d,m,y] <- [[(x) | x <- tail (words line)] | line <- lines]]
  8.     return rez
  9.  
  10. main = do
  11.     file <- openFile "input.txt" ReadMode
  12.     wordList <- loadList file
  13.     print (fst ((filter ((==(maximum [snd x | x <- wordList])).snd) wordList)!!0))
  14.     print (fst ((filter ((==(minimum [snd x | x <- wordList])).snd) wordList)!!0))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement