結果

問題 No.2252 Find Zero
ユーザー maimai
提出日時 2023-03-24 21:52:17
言語 Ruby
(3.3.0)
結果
AC  
実行時間 163 ms / 2,000 ms
コード長 263 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 11,924 KB
実行使用メモリ 32,580 KB
平均クエリ数 78.17
最終ジャッジ日時 2023-10-18 20:59:58
合計ジャッジ時間 4,411 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 146 ms
32,548 KB
testcase_01 AC 163 ms
32,548 KB
testcase_02 AC 138 ms
32,548 KB
testcase_03 AC 153 ms
32,548 KB
testcase_04 AC 138 ms
32,556 KB
testcase_05 AC 139 ms
32,556 KB
testcase_06 AC 138 ms
32,556 KB
testcase_07 AC 138 ms
32,556 KB
testcase_08 AC 154 ms
32,548 KB
testcase_09 AC 157 ms
32,548 KB
testcase_10 AC 142 ms
32,556 KB
testcase_11 AC 143 ms
32,552 KB
testcase_12 AC 141 ms
32,556 KB
testcase_13 AC 142 ms
32,556 KB
testcase_14 AC 141 ms
32,556 KB
testcase_15 AC 140 ms
32,556 KB
testcase_16 AC 140 ms
32,556 KB
testcase_17 AC 144 ms
32,580 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i

(n/2).times do |i|
  u = i*2
  v = i*2+1
  puts "? #{u} #{v}"
  STDOUT.flush
  w = gets.to_i
  if u == w
    puts "! #{v}"
    STDOUT.flush
    exit
  elsif v == w
    puts "! #{u}"
    STDOUT.flush
    exit
  end
end

puts "! #{n-1}"
STDOUT.flush
0