結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー ducktailducktail
提出日時 2018-04-11 15:11:21
言語 Haskell
(9.8.2)
結果
AC  
実行時間 352 ms / 2,000 ms
コード長 402 bytes
コンパイル時間 8,260 ms
コンパイル使用メモリ 160,888 KB
実行使用メモリ 35,812 KB
最終ジャッジ日時 2023-09-09 04:04:54
合計ジャッジ時間 11,374 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,152 KB
testcase_01 AC 2 ms
6,732 KB
testcase_02 AC 3 ms
7,156 KB
testcase_03 AC 3 ms
7,856 KB
testcase_04 AC 12 ms
11,368 KB
testcase_05 AC 43 ms
13,052 KB
testcase_06 AC 182 ms
20,768 KB
testcase_07 AC 352 ms
33,860 KB
testcase_08 AC 162 ms
35,812 KB
testcase_09 AC 102 ms
31,240 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 ((<$>))

main :: IO ()
main = solve <$> getLine >>= mapM_ print

solve :: String -> [Double]
solve s = f [] (length $ filter (== 'o') s) (length s) s
  where
    f ds _ _ [] = reverse ds
    f ds t b (x:xs) = let p = (fromIntegral t) / (fromIntegral b) * 100
                      in if x == 'o' then f (p:ds) (t-1) (b-1) xs
                         else f (p:ds) t (b-1) xs
0