結果

問題 No.246 質問と回答
ユーザー kuuso1kuuso1
提出日時 2015-07-17 23:16:03
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 1,224 bytes
コンパイル時間 3,536 ms
コンパイル使用メモリ 104,908 KB
実行使用メモリ 39,044 KB
平均クエリ数 34.23
最終ジャッジ日時 2023-09-23 19:56:51
合計ジャッジ時間 8,434 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
36,272 KB
testcase_01 AC 99 ms
36,584 KB
testcase_02 AC 99 ms
36,288 KB
testcase_03 AC 99 ms
36,692 KB
testcase_04 AC 96 ms
38,764 KB
testcase_05 AC 96 ms
34,120 KB
testcase_06 AC 97 ms
36,472 KB
testcase_07 AC 96 ms
36,280 KB
testcase_08 AC 99 ms
38,932 KB
testcase_09 AC 99 ms
36,852 KB
testcase_10 AC 97 ms
36,252 KB
testcase_11 AC 97 ms
38,884 KB
testcase_12 AC 97 ms
36,688 KB
testcase_13 AC 95 ms
38,852 KB
testcase_14 AC 95 ms
36,284 KB
testcase_15 AC 98 ms
38,280 KB
testcase_16 AC 98 ms
36,784 KB
testcase_17 AC 98 ms
39,044 KB
testcase_18 AC 92 ms
34,396 KB
testcase_19 AC 92 ms
38,312 KB
testcase_20 AC 94 ms
36,600 KB
testcase_21 AC 96 ms
36,660 KB
testcase_22 AC 96 ms
38,240 KB
testcase_23 AC 98 ms
36,728 KB
testcase_24 AC 99 ms
36,692 KB
testcase_25 AC 95 ms
35,004 KB
testcase_26 AC 91 ms
36,396 KB
testcase_27 AC 94 ms
37,108 KB
testcase_28 AC 94 ms
36,936 KB
testcase_29 AC 96 ms
36,420 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
 
class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int l=1;
		int r=(int)1e9;
		int c=0;
		while(r-l>1){
			c=(r+l)/2;
			Console.WriteLine("? {0}",c);
			var res=ri();
			if(res==1){
				l=c;
			}else{
				r=c;
			}
		}
		
		while(true){
			Console.WriteLine("? {0}",c);
			var res=ri();
			if(res!=1){c--;continue;}
			break;
		}
		while(true){
			Console.WriteLine("? {0}",c);
			var res=ri();
			if(res==1){c++;continue;}
			break;
		}
		Console.WriteLine("! {0}",c-1);
		
		
	}

	public Sol(){
	}




	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
0