Created
January 15, 2015 16:21
-
-
Save techno-tanoC/ff4981ebd84994c38c75 to your computer and use it in GitHub Desktop.
マンガ版「エンジニアでも恋がしたい!」〜転職初日にぶつかった女の子が同僚だった件〜|paizaオンラインハッカソン4 Lite https://paiza.jp/poh/enkoi-ending/fe7cbf79
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
import Control.Applicative | |
import Control.Monad | |
import Data.IntMap | |
diffRange :: IntMap Int -> Int -> Int -> Int | |
diffRange xs t d = l - h | |
where | |
h = xs ! (d) | |
l = xs ! (d + t) | |
main = do | |
[t, n] <- Prelude.map read . words <$> getLine | |
ls <- replicateM n readLn | |
let psum = scanl (+) 0 ls | |
p = fromList . zip [0..] $ psum | |
calc = diffRange p t | |
count = n - t | |
print $ maximum . fmap calc $ [0..count] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment