結果
問題 | No.2252 Find Zero |
ユーザー | tenten |
提出日時 | 2024-05-02 12:55:33 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,646 bytes |
コンパイル時間 | 3,606 ms |
コンパイル使用メモリ | 80,508 KB |
実行使用メモリ | 57,264 KB |
平均クエリ数 | 78.17 |
最終ジャッジ日時 | 2024-05-02 12:55:44 |
合計ジャッジ時間 | 7,236 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | AC | 150 ms
56,992 KB |
testcase_03 | AC | 185 ms
57,056 KB |
testcase_04 | AC | 143 ms
56,720 KB |
testcase_05 | AC | 132 ms
56,628 KB |
testcase_06 | AC | 132 ms
56,784 KB |
testcase_07 | AC | 130 ms
56,880 KB |
testcase_08 | AC | 193 ms
56,752 KB |
testcase_09 | AC | 188 ms
57,264 KB |
testcase_10 | AC | 130 ms
56,728 KB |
testcase_11 | AC | 132 ms
56,876 KB |
testcase_12 | RE | - |
testcase_13 | AC | 129 ms
56,488 KB |
testcase_14 | AC | 139 ms
56,776 KB |
testcase_15 | RE | - |
testcase_16 | AC | 128 ms
56,736 KB |
testcase_17 | AC | 131 ms
56,476 KB |
ソースコード
import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); for (int i = 0; i < n; i += 2) { System.out.println("? " + i + " " + (i + 1)); System.out.flush(); int x = sc.nextInt(); if (x == i) { System.out.println("! " + (i + 1)); System.out.flush(); return; } else if (x == i + 1) { System.out.println("! " + i); System.out.flush(); return; } } System.out.println("! " + (n - 1)); System.out.flush(); } } class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }