結果

問題 No.146 試験監督(1)
ユーザー NaruYNaruY
提出日時 2018-02-15 21:20:23
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 624 bytes
コンパイル時間 1,709 ms
コンパイル使用メモリ 169,868 KB
実行使用メモリ 36,480 KB
最終ジャッジ日時 2023-08-28 13:03:13
合計ジャッジ時間 2,833 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Control.Monad
import Control.Applicative
import Data.List
import qualified Data.Map as Map
import qualified Data.ByteString.Char8 as BC
import Data.Array
import Data.Maybe


strToInt s = (read :: String -> Int) s
readInt :: BC.ByteString -> Int
readInt = fst . fromJust . BC.readInt


main = do
    n <- readLn :: IO Int
    cd <- map ((map readInt . BC.words)) <$> replicateM n BC.getLine
    print $ f cd
    
f :: [[Int]] -> Int
f [] = 0
f (a:an) = mod ((f an) + (g (head a)) * (last a)) 1000000007
            where g x = if (even x)
                        then div x 2
                        else (div x 2) + 1
0