結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー pekempeypekempey
提出日時 2018-03-23 22:50:28
言語 Haskell
(9.8.2)
結果
AC  
実行時間 302 ms / 2,000 ms
コード長 356 bytes
コンパイル時間 6,802 ms
コンパイル使用メモリ 161,284 KB
実行使用メモリ 15,812 KB
最終ジャッジ日時 2023-09-07 03:44:35
合計ジャッジ時間 9,647 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,060 KB
testcase_01 AC 3 ms
6,744 KB
testcase_02 AC 3 ms
7,096 KB
testcase_03 AC 3 ms
7,872 KB
testcase_04 AC 12 ms
11,332 KB
testcase_05 AC 42 ms
11,652 KB
testcase_06 AC 152 ms
13,992 KB
testcase_07 AC 302 ms
15,812 KB
testcase_08 AC 112 ms
15,780 KB
testcase_09 AC 63 ms
15,804 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 Data.List (scanl)

main = getLine >>= mapM_ print . solve

solve :: String -> [Double]
solve s = map (\(o, n) -> fromIntegral o / fromIntegral n * 100) $ init $ scanl f (o, n) s
  where
    o = length $ filter (=='o') $ s
    n = length s

    f :: (Int, Int) -> Char -> (Int, Int)
    f (o, n) 'o' = (o - 1, n - 1)
    f (o, n) 'x' = (o    , n - 1)
0