結果
問題 |
No.3212 SUPER Guess the Number
|
ユーザー |
![]() |
提出日時 | 2025-07-25 22:31:28 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 664 bytes |
コンパイル時間 | 2,181 ms |
コンパイル使用メモリ | 87,600 KB |
実行使用メモリ | 64,080 KB |
平均クエリ数 | 22.00 |
最終ジャッジ日時 | 2025-07-25 22:31:41 |
合計ジャッジ時間 | 5,449 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 WA * 4 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int[] x = new int[25]; System.out.println("? 0"); int i = 0; int ok = 1000000; int ng = 0; while (Math.abs(ok - ng) > 1) { int mid = (ok + ng) / 2; int cx = x[i]; i++; int nx = mid * 2 - cx; x[i] = nx; System.out.println("? " + nx); int res = sc.nextInt(); if (cx < nx) { if (res == 0) { ok = mid; } else { ng = mid; } } else { if (res == 1) { ok = mid; } else { ng = mid; } } } System.out.println("! " + ok); sc.close(); } }