結果

問題 No.754 畳み込みの和
ユーザー LeonardoneLeonardone
提出日時 2018-12-02 04:39:46
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 288 bytes
コンパイル時間 4,258 ms
コンパイル使用メモリ 158,068 KB
実行使用メモリ 162,884 KB
最終ジャッジ日時 2023-09-09 23:12:50
合計ジャッジ時間 7,640 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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