Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved code according to hlint suggestions
- Loading branch information
Anton Guryanov
committed
Mar 12, 2013
1 parent
5446d34
commit e583152
Showing
3 changed files
with
11 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
module Main where | ||
|
||
import Control.Monad | ||
import Data.List | ||
|
||
main = do | ||
distances <- getLine >> getLine >>= (return . map read . words) :: IO [Int] | ||
[s1, s2] <- getLine >>= (return . sort . map read . words) :: IO [Int] | ||
distances <- liftM (map read . words) (getLine >> getLine) :: IO [Int] | ||
[s1, s2] <- liftM (sort . map read . words) getLine:: IO [Int] | ||
let total = sum distances | ||
dist = sum $ drop (s1 - 1) $ take (s2 - 1) distances | ||
print $ min dist (total - dist) |