結果
| 問題 | No.305 鍵(2) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-08-08 16:39:48 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 2,000 ms |
| コード長 | 627 bytes |
| コンパイル時間 | 2,050 ms |
| コンパイル使用メモリ | 174,976 KB |
| 実行使用メモリ | 25,220 KB |
| 平均クエリ数 | 43.54 |
| 最終ジャッジ日時 | 2024-07-17 01:51:36 |
| 合計ジャッジ時間 | 3,371 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
import Control.Applicative ((<$>))
import Control.Monad (unless)
import System.IO (hFlush, stdout)
import Text.Printf
main :: IO ()
main = do
printf "%010d\n" (0::Int)
hFlush stdout
[s,rslt] <- words <$> getLine
unless (rslt == "unlocked") $ solve (read s) 0 1
solve :: Int -> Int -> Int -> IO ()
solve mtc ecn d = do
let nn = ecn + d
printf "%010d\n" nn
hFlush stdout
[s,rslt] <- words <$> getLine
unless (rslt == "unlocked") $ do
let nc = read s :: Int
if nc > mtc then do
solve nc nn (d * 10)
else if nc < mtc then do
solve mtc ecn (d * 10)
else do
solve mtc nn d