結果
| 問題 |
No.118 門松列(2)
|
| ユーザー |
aimy
|
| 提出日時 | 2017-04-21 16:39:02 |
| 言語 | Haskell (9.10.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 462 bytes |
| コンパイル時間 | 2,694 ms |
| コンパイル使用メモリ | 172,160 KB |
| 実行使用メモリ | 40,580 KB |
| 最終ジャッジ日時 | 2024-07-20 05:05:49 |
| 合計ジャッジ時間 | 7,623 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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 :: [Integer] -> Integer kadomatsu (n:as) = mod (comb n 3) q - mod dup q where dup = sum $ map comb' $ filter (>1) $ map (fromIntegral . length) $ group $ sort as comb' m | m==2 = n - m | otherwise = mod (comb m 2 * (n-m) + comb m 3) q
aimy