結果
問題 |
No.118 門松列(2)
|
ユーザー |
![]() |
提出日時 | 2017-04-21 16:35:43 |
言語 | Haskell (9.10.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 411 bytes |
コンパイル時間 | 8,551 ms |
コンパイル使用メモリ | 170,436 KB |
実行使用メモリ | 73,472 KB |
最終ジャッジ日時 | 2024-07-20 05:05:12 |
合計ジャッジ時間 | 9,743 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 WA * 14 |
コンパイルメッセージ
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 q = 10^9+7 comb n r = iterate (scanl1 (\x y -> mod (x+y) q)) [1,1..] !! (n'-r') !! r' where [n',r'] = map fromIntegral [n,r] main = getContents >>= print . kadomatsu . map read . words kadomatsu (n:as) = mod (comb n 3) q - mod dup q where dup = sum $ map comb' $ filter (>1) $ map length $ group $ sort as comb' m | m==2 = n - m | otherwise = mod (comb m 2 * (n-m) + comb m 3) q