結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー NekosanNekosan
提出日時 2015-08-11 13:05:42
言語 Haskell
(9.8.2)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 610 bytes
コンパイル時間 2,555 ms
コンパイル使用メモリ 163,676 KB
実行使用メモリ 24,384 KB
平均クエリ数 3.70
最終ジャッジ日時 2023-09-23 21:20:00
合計ジャッジ時間 5,392 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
23,580 KB
testcase_01 AC 45 ms
24,060 KB
testcase_02 AC 46 ms
23,700 KB
testcase_03 AC 42 ms
24,300 KB
testcase_04 AC 37 ms
23,688 KB
testcase_05 AC 36 ms
23,436 KB
testcase_06 AC 37 ms
24,384 KB
testcase_07 AC 42 ms
23,880 KB
testcase_08 AC 37 ms
23,580 KB
testcase_09 AC 36 ms
23,652 KB
testcase_10 AC 38 ms
23,688 KB
testcase_11 AC 44 ms
23,460 KB
testcase_12 AC 45 ms
24,048 KB
testcase_13 AC 38 ms
24,036 KB
testcase_14 AC 38 ms
23,580 KB
testcase_15 AC 46 ms
23,892 KB
testcase_16 AC 39 ms
23,688 KB
testcase_17 AC 44 ms
24,048 KB
testcase_18 AC 39 ms
23,424 KB
testcase_19 AC 44 ms
24,060 KB
testcase_20 AC 36 ms
24,036 KB
testcase_21 AC 37 ms
24,288 KB
testcase_22 AC 44 ms
23,460 KB
testcase_23 AC 42 ms
23,676 KB
testcase_24 AC 37 ms
23,580 KB
testcase_25 AC 39 ms
23,580 KB
testcase_26 AC 37 ms
24,324 KB
testcase_27 AC 37 ms
24,324 KB
testcase_28 AC 37 ms
24,036 KB
testcase_29 AC 37 ms
23,568 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 (-1)
    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