結果

問題 No.327 アルファベット列
ユーザー 37zigen
提出日時 2016-03-22 17:57:52
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 560 bytes
コンパイル時間 2,469 ms
コンパイル使用メモリ 75,816 KB
実行使用メモリ 41,860 KB
最終ジャッジ日時 2024-10-01 13:02:42
合計ジャッジ時間 10,875 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder246;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int upper=(int)Math.pow(10, 9);
		int low=0;
		
		while(upper!=low){
			int mid=(int)(upper+low)/2;
			System.out.println("? "+mid);
			int a=sc.nextInt();
			if(a==1){
				low=mid;
				if(upper==low+1){
					System.out.println("! "+upper);
					sc.close();
					return;
				}
			}else{
				upper=mid;
				if(upper==low){
					System.out.println("! "+upper);
					sc.close();
					return;
				}
			}
		}
		
	}
}
0