結果

問題 No.253 ロウソクの長さ
ユーザー 37zigen37zigen
提出日時 2016-03-22 17:25:56
言語 Java21
(openjdk 21)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,055 bytes
コンパイル時間 3,860 ms
コンパイル使用メモリ 75,900 KB
実行使用メモリ 73,204 KB
平均クエリ数 32.17
最終ジャッジ日時 2023-09-23 23:22:13
合計ジャッジ時間 13,244 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 166 ms
73,204 KB
testcase_01 AC 151 ms
72,372 KB
testcase_02 AC 157 ms
71,764 KB
testcase_03 AC 148 ms
71,656 KB
testcase_04 AC 145 ms
72,440 KB
testcase_05 AC 155 ms
71,516 KB
testcase_06 AC 170 ms
72,444 KB
testcase_07 AC 168 ms
72,768 KB
testcase_08 AC 165 ms
73,008 KB
testcase_09 AC 145 ms
71,324 KB
testcase_10 AC 172 ms
72,936 KB
testcase_11 AC 172 ms
72,928 KB
testcase_12 AC 166 ms
72,620 KB
testcase_13 AC 167 ms
72,716 KB
testcase_14 AC 143 ms
71,608 KB
testcase_15 AC 161 ms
72,208 KB
testcase_16 AC 158 ms
72,260 KB
testcase_17 AC 131 ms
69,568 KB
testcase_18 AC 163 ms
72,340 KB
testcase_19 AC 139 ms
72,124 KB
testcase_20 AC 160 ms
72,556 KB
testcase_21 AC 155 ms
71,304 KB
testcase_22 AC 148 ms
71,608 KB
testcase_23 AC 166 ms
72,628 KB
testcase_24 AC 158 ms
71,612 KB
testcase_25 AC 165 ms
72,756 KB
testcase_26 AC 166 ms
71,948 KB
testcase_27 AC 170 ms
72,692 KB
testcase_28 AC 178 ms
73,000 KB
testcase_29 AC 160 ms
72,464 KB
testcase_30 AC 164 ms
72,744 KB
testcase_31 AC 169 ms
73,036 KB
testcase_32 AC 167 ms
57,032 KB
testcase_33 TLE -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder253;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		System.out.println("?100");
		System.err.println(101);
		int a=sc.nextInt();
		int count=0;
		if(a==-1){
			for(int i=0;i<100;i++){
				System.out.println("?0");
				count++;
				int b=sc.nextInt();
				if(b==0){
					System.out.println("!"+count);
					sc.close();
					System.exit(0);
				}
			}
		}else if(a==1){
			int upper=(int)Math.pow(10,9);
			int low=101;
			int mid;
			int ans=101;
			while(low!=upper){
				count++;
				upper--;
				low--;
				ans--;
				mid=(int)(upper+low)/2;
				System.out.println("?"+mid);
				System.err.println("ans="+ans);
				System.err.println("upper="+upper+" low="+low);
				int r=sc.nextInt();
				if(r==1){
					low=mid;
				}else if(r==-1){
					upper=mid;
				}else if(r==0){
					System.out.println("!"+(mid+count));
					sc.close();
					System.exit(0);
				}
			}
		}else if(a==0){
			System.out.println("!100");
			sc.close();
			System.exit(0);
		}

	}
}

0