結果

問題 No.305 鍵(2)
ユーザー LeonardoneLeonardone
提出日時 2015-12-01 05:03:32
言語 Haskell
(9.8.2)
結果
RE  
実行時間 -
コード長 588 bytes
コンパイル時間 9,733 ms
コンパイル使用メモリ 163,004 KB
実行使用メモリ 24,408 KB
平均クエリ数 47.77
最終ジャッジ日時 2023-09-23 08:12:58
合計ジャッジ時間 12,756 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 29 ms
24,036 KB
testcase_06 AC 26 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 && b < 10 -> 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