結果

問題 No.754 畳み込みの和
ユーザー LeonardoneLeonardone
提出日時 2018-12-02 04:36:39
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 286 bytes
コンパイル時間 8,272 ms
コンパイル使用メモリ 160,020 KB
実行使用メモリ 162,912 KB
最終ジャッジ日時 2023-09-09 23:11:36
合計ジャッジ時間 9,765 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 #

-- Try yukicoder
-- author: Leonardone @ NEETSDKASU

main = interact $ show . solve . map read . words

solve (n:vs) = ans `mod` 10^9 + 7 where
    (xs, ys) = splitAt (n+1) vs 
    zs = zip xs (reverse ys)
    ans = fst $ foldl f (0, 0) zs
    f (a, s) (x, y) = (a + y * (s + x), s + x)
0