結果

問題 No.2252 Find Zero
ユーザー 👑 obakyanobakyan
提出日時 2023-04-29 14:53:53
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 371 bytes
コンパイル時間 54 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 25,488 KB
平均クエリ数 78.17
最終ジャッジ日時 2024-04-29 08:55:18
合計ジャッジ時間 2,971 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
25,436 KB
testcase_01 AC 79 ms
24,812 KB
testcase_02 AC 57 ms
24,556 KB
testcase_03 AC 66 ms
25,196 KB
testcase_04 AC 57 ms
25,232 KB
testcase_05 AC 56 ms
25,232 KB
testcase_06 AC 56 ms
24,848 KB
testcase_07 AC 56 ms
25,232 KB
testcase_08 AC 64 ms
25,488 KB
testcase_09 AC 67 ms
25,488 KB
testcase_10 AC 53 ms
24,604 KB
testcase_11 AC 54 ms
25,232 KB
testcase_12 AC 53 ms
24,592 KB
testcase_13 AC 52 ms
25,104 KB
testcase_14 AC 54 ms
25,104 KB
testcase_15 AC 53 ms
25,232 KB
testcase_16 AC 53 ms
25,232 KB
testcase_17 AC 56 ms
24,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local n = io.read("*n", "*l")
for i = 0, n - 2, 2 do
  io.write("? " .. i .. " " .. i + 1 .. "\n")
  io.flush()
  local ans = io.read("*n", "*l")
  if ans == i then
    io.write("! " .. i + 1 .. "\n")
    io.flush()
    os.exit()
  elseif ans == i + 1 then
    io.write("! " .. i .. "\n")
    io.flush()
    os.exit()
  end
end
io.write("! " .. n - 1 .. "\n")
io.flush()
0