結果

問題 No.305 鍵(2)
ユーザー LeonardoneLeonardone
提出日時 2015-12-01 05:01:43
言語 Haskell
(9.8.2)
結果
RE  
実行時間 -
コード長 578 bytes
コンパイル時間 9,617 ms
コンパイル使用メモリ 166,648 KB
実行使用メモリ 24,528 KB
平均クエリ数 1.92
最終ジャッジ日時 2023-09-23 08:12:42
合計ジャッジ時間 12,875 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 27 ms
23,988 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 #

-- yukicoder My Practice
-- author: Leonardone @ NEETSDKASU

import Control.Applicative
import System.IO
import Data.List
import Data.Char

main = g ['0' | _ <- [1..10]] []  10

f s =
    putStrLn s >>
    hFlush stdout >>
    read . head . words <$> getLine

g (x:xs) ys b = do
    r <- f $ (x:xs) ++ ys
    case r of
        10 -> return ()
        r | r > b -> g xs (x:ys) 10
        r | r < b -> g xs ((dec x):ys) 10
        _ -> g ((inc x):xs) ys r
        where
            calc c o = chr $ flip o 1 $ ord $ c
            dec c = calc c (-)
            inc c = calc c (+)
0