結果
| 問題 | No.77 レンガのピラミッド |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-04 15:07:27 |
| 言語 | Haskell (9.14.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 362 bytes |
| 記録 | |
| コンパイル時間 | 8,233 ms |
| コンパイル使用メモリ | 195,356 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-03-20 06:22:21 |
| 合計ジャッジ時間 | 9,286 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 20 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
import Control.Applicative ((<$>))
main :: IO ()
main = getLine >> solve <$> map read <$> words <$> getLine >>= print
solve :: [Int] -> Int
solve xs = sum $ zipWith f xs (pyramid xs)
where pyramid xs = [1..h] ++ [h-1, h-2..1] ++ repeat 0
where h = floor . sqrt . fromIntegral . sum $ xs
f x y | x >= y = x - y
| otherwise = 0