結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー okadukiokaduki
提出日時 2018-03-23 23:25:44
言語 Haskell
(9.6.2)
結果
AC  
実行時間 292 ms / 2,000 ms
コード長 463 bytes
コンパイル時間 9,816 ms
コンパイル使用メモリ 163,360 KB
実行使用メモリ 15,716 KB
最終ジャッジ日時 2023-09-07 04:19:32
合計ジャッジ時間 12,805 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,112 KB
testcase_01 AC 2 ms
6,860 KB
testcase_02 AC 3 ms
7,108 KB
testcase_03 AC 3 ms
7,780 KB
testcase_04 AC 12 ms
11,264 KB
testcase_05 AC 42 ms
11,700 KB
testcase_06 AC 153 ms
14,008 KB
testcase_07 AC 292 ms
15,696 KB
testcase_08 AC 102 ms
15,648 KB
testcase_09 AC 62 ms
15,716 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 #

{-# LANGUAGE FlexibleContexts, OverloadedStrings #-}
import Control.Applicative
import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)
import Text.Printf
import Debug.Trace

solve [] _ = return ()
solve (s:ss) (o,x) = print (fromIntegral o / (fromIntegral (o+x)) * 100) >> solve ss (if s == 'o' then (o-1,x) else (o,x-1))

main = do
  s <- getLine
  let o = length $ filter (=='o') s
  let x = length s - o
  solve s (o,x)

0