結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー NekosanNekosan
提出日時 2015-08-11 12:57:38
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 607 bytes
コンパイル時間 4,407 ms
コンパイル使用メモリ 163,724 KB
実行使用メモリ 24,312 KB
平均クエリ数 3.27
最終ジャッジ日時 2023-09-23 05:41:45
合計ジャッジ時間 9,042 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 50 ms
23,628 KB
testcase_02 AC 52 ms
23,532 KB
testcase_03 AC 50 ms
23,424 KB
testcase_04 WA -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 51 ms
23,916 KB
testcase_08 AC 51 ms
23,844 KB
testcase_09 AC 51 ms
23,412 KB
testcase_10 AC 47 ms
24,312 KB
testcase_11 AC 49 ms
24,228 KB
testcase_12 AC 50 ms
23,460 KB
testcase_13 AC 51 ms
23,412 KB
testcase_14 AC 48 ms
23,400 KB
testcase_15 AC 50 ms
23,688 KB
testcase_16 WA -
testcase_17 AC 53 ms
23,916 KB
testcase_18 AC 51 ms
23,700 KB
testcase_19 WA -
testcase_20 AC 47 ms
24,288 KB
testcase_21 AC 49 ms
23,424 KB
testcase_22 AC 51 ms
24,084 KB
testcase_23 AC 51 ms
23,568 KB
testcase_24 AC 47 ms
23,568 KB
testcase_25 AC 51 ms
23,640 KB
testcase_26 AC 49 ms
23,556 KB
testcase_27 AC 51 ms
24,072 KB
testcase_28 AC 51 ms
23,976 KB
testcase_29 AC 51 ms
23,556 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 System.IO

main = do
    line <- getLine
    let n = read $ (words line) !! 0 :: Int
        k = read $ (words line) !! 1 :: Int
        ans = show $ ai n k 0
    putStrLn ans
    hFlush stdout
    game n k


game :: Int -> Int -> IO ()
game n k = do
    opp <- getLine
    let s = read opp :: Int
    if s < n
        then do
            let ans = show $ ai n k s
            putStrLn ans
            hFlush stdout
            game n k
        else
            return ()


ai :: Int -> Int -> Int -> Int
ai n k s = last ansList
    where   ansList = takeWhile (>s) [n - x * (k + 1) - 1 | x <- [0..]]
0