結果

問題 No.246 質問と回答
ユーザー BantakoBantako
提出日時 2017-07-26 11:08:16
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 352 bytes
コンパイル時間 1,102 ms
コンパイル使用メモリ 142,388 KB
実行使用メモリ 24,432 KB
平均クエリ数 27.50
最終ジャッジ日時 2023-09-23 14:20:34
合計ジャッジ時間 4,271 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 39 ms
23,856 KB
testcase_10 AC 39 ms
23,400 KB
testcase_11 AC 40 ms
23,436 KB
testcase_12 AC 41 ms
23,364 KB
testcase_13 AC 39 ms
23,808 KB
testcase_14 AC 38 ms
24,372 KB
testcase_15 WA -
testcase_16 AC 40 ms
24,012 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 39 ms
24,252 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 39 ms
23,616 KB
testcase_29 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:2:6: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
 main(){
      ^

ソースコード

diff #

#include<bits/stdc++.h>
main(){
    int min = 0,max = 100000000;
    while(min!=max){
        printf("? %d\n",(min+max)/2);
        fflush(stdout);
        int ans;
        scanf("%d",&ans);
        if(ans){
            min = (min+max+1)/2;
        }else{
            max = (min+max-1)/2;
        }
    }
    printf("! %d\n",min);
    fflush(stdout);
}
0