結果
問題 | No.5 数字のブロック |
ユーザー |
![]() |
提出日時 | 2015-10-09 19:54:53 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 25 ms / 5,000 ms |
コード長 | 529 bytes |
コンパイル時間 | 8,270 ms |
コンパイル使用メモリ | 176,512 KB |
実行使用メモリ | 10,112 KB |
最終ジャッジ日時 | 2024-11-18 07:47:01 |
合計ジャッジ時間 | 9,539 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
import Data.List (sort) import Control.Applicative ((<$>)) findMaximum :: Int -> [Int] -> Int findMaximum = findMaximum' 0 0 where findMaximum' :: Int -> Int -> Int -> [Int] -> Int findMaximum' n w l [] = n findMaximum' n w l (b : bs) | w' > l = n | otherwise = findMaximum' (n + 1) w' l bs where w' = w + b main :: IO () main = do l <- readLn :: IO Int _ <- getLine bs <- sort . map read . words <$> getLine putStrLn $ show $ findMaximum l bs