結果

問題 No.246 質問と回答
ユーザー abL8ZLsTbFabL8ZLsTbF
提出日時 2016-08-29 15:35:15
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 400 bytes
コンパイル時間 1,893 ms
コンパイル使用メモリ 106,680 KB
実行使用メモリ 42,796 KB
平均クエリ数 79.90
最終ジャッジ日時 2024-07-16 10:57:00
合計ジャッジ時間 5,454 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 RE * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Program
{
	public static void Main()
	{
		int min = 0, max = (int)Math.Pow(10, 9);
		int mid;
		for (mid = (min + max) / 2; min != max; mid = (min + max) / 2)
		{
			Console.WriteLine("? {0}", mid);
			bool isLess = int.Parse(Console.ReadLine()) == 0;
			if (isLess)
			{
				max = mid - 1;
			}
			else
			{
				min = mid;
			}
		}
		Console.WriteLine("! {0}", mid);
	}
}
0