結果

問題 No.162 8020運動
ユーザー gigurururugigurururu
提出日時 2015-03-06 23:33:54
言語 Haskell
(9.8.2)
結果
AC  
実行時間 12 ms / 5,000 ms
コード長 643 bytes
コンパイル時間 3,291 ms
コンパイル使用メモリ 160,680 KB
実行使用メモリ 10,908 KB
最終ジャッジ日時 2023-09-06 20:19:59
合計ジャッジ時間 5,243 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,360 KB
testcase_01 AC 5 ms
8,936 KB
testcase_02 AC 7 ms
9,852 KB
testcase_03 AC 12 ms
10,656 KB
testcase_04 AC 12 ms
10,908 KB
testcase_05 AC 12 ms
10,652 KB
testcase_06 AC 12 ms
10,756 KB
testcase_07 AC 8 ms
10,712 KB
testcase_08 AC 12 ms
10,684 KB
testcase_09 AC 2 ms
7,400 KB
testcase_10 AC 6 ms
9,792 KB
testcase_11 AC 5 ms
8,768 KB
testcase_12 AC 4 ms
7,920 KB
testcase_13 AC 12 ms
10,552 KB
testcase_14 AC 3 ms
7,416 KB
testcase_15 AC 3 ms
7,584 KB
testcase_16 AC 4 ms
8,244 KB
testcase_17 AC 3 ms
7,756 KB
testcase_18 AC 8 ms
10,528 KB
testcase_19 AC 7 ms
9,572 KB
testcase_20 AC 7 ms
10,048 KB
testcase_21 AC 7 ms
10,152 KB
testcase_22 AC 6 ms
9,652 KB
testcase_23 AC 12 ms
10,120 KB
testcase_24 AC 7 ms
9,852 KB
testcase_25 AC 8 ms
10,072 KB
testcase_26 AC 3 ms
7,340 KB
testcase_27 AC 5 ms
9,048 KB
testcase_28 AC 12 ms
10,396 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Applicative
import Data.List

repeated_combination ns n = comb n [(ns,[])]
  where
    comb 0 xs = [a|(_,a)<-xs]
    comb c xs = comb (c-1) $ concatMap f xs
    f (xs,ys) = [(as,ys++[a])|as@(a:_)<-tails xs]

main = do
  n <- (80-).read <$> getLine
  [a,b,c] <- map ((/100).read) . words <$> getLine
  let pa 0 = [1,1]
      pa 1 = [1,a,1]
      pa n = [1,b]++(replicate (n-2) c)++[b,1]
      update s n = foldl (sub s $ pa n) 0 $ repeated_combination [1..n] 2
      sub s p t [i,j] = t+(foldl (\u k->u*(1-p!!k)) (s!!(j-i+1)*p!!(i-1)*p!!(j+1)) [i..j])
    in print $ ((foldl (\s _->map (update s) [0..14]) [0..14] [1..n])!!14)*2
0