結果
問題 | No.161 制限ジャンケン |
ユーザー | Haar |
提出日時 | 2016-09-01 02:23:05 |
言語 | Haskell (9.8.2) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 614 bytes |
コンパイル時間 | 1,472 ms |
コンパイル使用メモリ | 165,756 KB |
実行使用メモリ | 7,192 KB |
最終ジャッジ日時 | 2023-08-20 04:53:36 |
合計ジャッジ時間 | 2,869 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
7,152 KB |
testcase_01 | AC | 3 ms
6,968 KB |
testcase_02 | AC | 3 ms
6,892 KB |
testcase_03 | AC | 3 ms
6,904 KB |
testcase_04 | AC | 2 ms
6,900 KB |
testcase_05 | AC | 3 ms
6,952 KB |
testcase_06 | AC | 3 ms
7,068 KB |
testcase_07 | AC | 2 ms
7,052 KB |
testcase_08 | AC | 3 ms
7,148 KB |
testcase_09 | AC | 3 ms
7,176 KB |
testcase_10 | AC | 2 ms
7,144 KB |
testcase_11 | AC | 3 ms
7,044 KB |
testcase_12 | AC | 3 ms
7,104 KB |
testcase_13 | AC | 3 ms
7,192 KB |
testcase_14 | AC | 2 ms
7,128 KB |
testcase_15 | AC | 3 ms
7,064 KB |
testcase_16 | AC | 2 ms
7,056 KB |
testcase_17 | AC | 2 ms
7,080 KB |
testcase_18 | AC | 3 ms
7,092 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
ソースコード
import Control.Applicative main :: IO() main = do [g,c,p] <- map (read::String->Int) . words <$> getLine s <- getLine let (sg,sc,sp) = count s let (g',c',p') = (min' g sc,min' c sp,min' p sg) let (g'',c'',p'') = (g-g',c-c',p-p') let (g''',c''',p''') = (sg-p',sc-g',sp-c') print $ (g'+c'+p')*3 + (min' g'' g''' + min' c'' c''' + min' p'' p''') count (x:xs) | x == 'G' = (1,0,0) `add` count xs | x == 'C' = (0,1,0) `add` count xs | x == 'P' = (0,0,1) `add` count xs where add (a,b,c) (a',b',c') = (a+a',b+b',c+c') count [] = (0,0,0) min' a b = minimum [a,b]