結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー aimyaimy
提出日時 2017-04-22 17:35:41
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 397 bytes
コンパイル時間 12,024 ms
コンパイル使用メモリ 160,580 KB
実行使用メモリ 26,484 KB
平均クエリ数 3.27
最終ジャッジ日時 2023-09-23 13:12:34
合計ジャッジ時間 5,399 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 47 ms
24,024 KB
testcase_02 AC 49 ms
23,676 KB
testcase_03 AC 48 ms
24,084 KB
testcase_04 WA -
testcase_05 AC 50 ms
23,868 KB
testcase_06 AC 46 ms
23,640 KB
testcase_07 RE -
testcase_08 AC 47 ms
23,568 KB
testcase_09 AC 51 ms
23,352 KB
testcase_10 AC 48 ms
24,240 KB
testcase_11 AC 50 ms
23,460 KB
testcase_12 AC 46 ms
23,868 KB
testcase_13 AC 48 ms
24,000 KB
testcase_14 AC 47 ms
24,072 KB
testcase_15 AC 49 ms
24,024 KB
testcase_16 WA -
testcase_17 AC 46 ms
23,448 KB
testcase_18 AC 50 ms
24,312 KB
testcase_19 WA -
testcase_20 AC 45 ms
23,676 KB
testcase_21 AC 46 ms
23,580 KB
testcase_22 AC 50 ms
23,400 KB
testcase_23 AC 45 ms
24,420 KB
testcase_24 AC 46 ms
24,420 KB
testcase_25 AC 49 ms
24,432 KB
testcase_26 AC 47 ms
23,712 KB
testcase_27 AC 47 ms
23,352 KB
testcase_28 AC 49 ms
24,024 KB
testcase_29 AC 45 ms
24,024 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 Control.Monad
import System.IO
import Data.List

next n k x = last (takeWhile (>x) [n-1,n-1-(k+1)..0])

main = do
 [n,k] <- map read . words <$> getLine
 if (div (n-1) (k+1) == 0) then putStrLn "0" else putStrLn (show (next n k 0))
 hFlush stdout
 main' n k
  where
   main' n k = do
    b <- read <$> getLine
    unless (b >= n) (putStrLn (show (next n k b)) >> hFlush stdout >> main' n k)
0