結果

問題 No.246 質問と回答
ユーザー りあんりあん
提出日時 2015-07-17 23:54:54
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 2,599 bytes
コンパイル時間 2,616 ms
コンパイル使用メモリ 107,456 KB
実行使用メモリ 38,780 KB
平均クエリ数 32.43
最終ジャッジ日時 2023-09-23 19:58:59
合計ジャッジ時間 7,557 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
34,876 KB
testcase_01 AC 99 ms
36,720 KB
testcase_02 AC 100 ms
36,300 KB
testcase_03 AC 99 ms
36,268 KB
testcase_04 AC 103 ms
36,448 KB
testcase_05 AC 101 ms
36,372 KB
testcase_06 AC 100 ms
36,408 KB
testcase_07 AC 99 ms
36,936 KB
testcase_08 AC 100 ms
38,672 KB
testcase_09 AC 101 ms
38,348 KB
testcase_10 AC 100 ms
38,284 KB
testcase_11 AC 99 ms
34,684 KB
testcase_12 AC 99 ms
36,928 KB
testcase_13 AC 100 ms
36,896 KB
testcase_14 AC 99 ms
36,956 KB
testcase_15 AC 101 ms
36,720 KB
testcase_16 AC 101 ms
36,972 KB
testcase_17 AC 100 ms
38,780 KB
testcase_18 AC 100 ms
36,932 KB
testcase_19 AC 101 ms
38,524 KB
testcase_20 AC 103 ms
36,928 KB
testcase_21 AC 100 ms
36,984 KB
testcase_22 AC 100 ms
36,900 KB
testcase_23 AC 99 ms
36,948 KB
testcase_24 AC 101 ms
38,412 KB
testcase_25 AC 100 ms
36,384 KB
testcase_26 AC 101 ms
38,512 KB
testcase_27 AC 100 ms
37,024 KB
testcase_28 AC 99 ms
36,916 KB
testcase_29 AC 100 ms
36,724 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.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Numerics;

namespace Solver
{
    class Program
    {
        const int M = 1000000007;
        const double eps = 10e-9;
        static void Main()
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            var sc = new Scan();
            int l = 1, r = int.MaxValue / 2;
            while (l < r)
            {
                int m = (l + r) / 2;
                sw.WriteLine("? {0}", m);
                sw.Flush();
                
                if (sc.Int == 1) l = m + 1;
                else r = m - 1;
            }
            ++r;
            while (true)
            {
                sw.WriteLine("? {0}", r);
                sw.Flush();
                if (sc.Int == 1)
                {
                    sw.WriteLine("! {0}", r);
                    sw.Flush();
                    return;
                }
                --r;
            }
        }
    }
    class Scan
    {
        public int Int { get { return int.Parse(Console.ReadLine().Trim()); } }
        public long Long { get { return long.Parse(Console.ReadLine().Trim()); } }
        public string Str { get { return Console.ReadLine().Trim(); } }
        public int[] IntArr { get { return Console.ReadLine().Trim().Split().Select(int.Parse).ToArray(); } }
        public long[] LongArr { get { return Console.ReadLine().Trim().Split().Select(long.Parse).ToArray(); } }
        public double[] DoubleArr { get { return Console.ReadLine().Split().Select(double.Parse).ToArray(); } }
        public string[] StrArr { get { return Console.ReadLine().Trim().Split(); } }
        public List<int> IntList { get { return Console.ReadLine().Trim().Split().Select(int.Parse).ToList(); } }
        public List<long> LongList { get { return Console.ReadLine().Trim().Split().Select(long.Parse).ToList(); } }
        public void Multi(out int a, out int b) { var arr = IntArr; a = arr[0]; b = arr[1]; }
        public void Multi(out int a, out int b, out int c) { var arr = IntArr; a = arr[0]; b = arr[1]; c = arr[2]; }
        public void Multi(out int a, out string b) { var arr = StrArr; a = int.Parse(arr[0]); b = arr[1]; }
        public void Multi(out int a, out char b) { var arr = StrArr; a = int.Parse(arr[0]); b = arr[1][0]; }
        public void Multi(out long a, out long b) { var arr = LongArr; a = arr[0]; b = arr[1]; }
        public void Multi(out string a, out string b) { var arr = StrArr; a = arr[0]; b = arr[1]; }
    }
}
0