結果
| 問題 | No.2252 Find Zero |
| コンテスト | |
| ユーザー |
ks2m
|
| 提出日時 | 2023-03-24 21:26:37 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 215 ms / 2,000 ms |
| コード長 | 635 bytes |
| コンパイル時間 | 2,431 ms |
| コンパイル使用メモリ | 82,772 KB |
| 実行使用メモリ | 57,416 KB |
| 平均クエリ数 | 78.17 |
| 最終ジャッジ日時 | 2024-09-18 16:43:16 |
| 合計ジャッジ時間 | 6,236 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 |
ソースコード
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int n2 = n / 2;
for (int i = 0; i < n2; i++) {
int x = i * 2;
int y = x + 1;
System.out.println("? " + x + " " + y);
int z = Integer.parseInt(br.readLine());
if (z == x) {
System.out.println("! " + y);
return;
}
if (z == y) {
System.out.println("! " + x);
return;
}
}
System.out.println("! " + (n - 1));
br.close();
}
}
ks2m