結果

問題 No.253 ロウソクの長さ
ユーザー 173205080173205080
提出日時 2019-07-12 11:09:23
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 658 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 28,528 KB
実行使用メモリ 24,312 KB
平均クエリ数 23.44
最終ジャッジ日時 2023-09-24 02:16:52
合計ジャッジ時間 3,363 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
23,520 KB
testcase_01 AC 25 ms
23,364 KB
testcase_02 AC 25 ms
24,048 KB
testcase_03 AC 24 ms
24,192 KB
testcase_04 AC 24 ms
23,400 KB
testcase_05 AC 24 ms
23,556 KB
testcase_06 AC 23 ms
23,412 KB
testcase_07 AC 25 ms
23,376 KB
testcase_08 AC 25 ms
23,988 KB
testcase_09 AC 23 ms
24,252 KB
testcase_10 AC 25 ms
24,048 KB
testcase_11 AC 25 ms
24,312 KB
testcase_12 AC 24 ms
24,000 KB
testcase_13 AC 25 ms
24,264 KB
testcase_14 AC 25 ms
23,532 KB
testcase_15 AC 24 ms
23,412 KB
testcase_16 AC 24 ms
23,496 KB
testcase_17 AC 25 ms
23,652 KB
testcase_18 AC 25 ms
23,364 KB
testcase_19 AC 24 ms
23,448 KB
testcase_20 AC 25 ms
23,700 KB
testcase_21 AC 24 ms
23,688 KB
testcase_22 AC 25 ms
24,060 KB
testcase_23 AC 25 ms
23,688 KB
testcase_24 AC 24 ms
24,084 KB
testcase_25 AC 25 ms
23,640 KB
testcase_26 AC 25 ms
24,288 KB
testcase_27 AC 25 ms
23,688 KB
testcase_28 AC 25 ms
24,252 KB
testcase_29 AC 25 ms
23,664 KB
testcase_30 AC 25 ms
23,460 KB
testcase_31 AC 25 ms
23,376 KB
testcase_32 AC 25 ms
23,424 KB
testcase_33 AC 25 ms
23,568 KB
testcase_34 AC 24 ms
24,012 KB
testcase_35 AC 25 ms
23,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define df 0
#define step 21
int i=-1;
int s=1000000000;
int a,b;

int ask(){
  printf("? %d\n",s);
  if(df)printf("(i=%d)\n",i);
  fflush(stdout);
  int flag;
  scanf("%d",&flag);
  return flag;
}

void ask2(){
  int c=(a+b)/2-i;
  printf("? %d\n",c);
  if(df)printf("(a,b=%d,%d)\n",a,b);
  fflush(stdout);
  int flag;
  scanf("%d",&flag);
  if(flag>=0) a=c+i;
  if(flag<=0) b=c+i;
}

int main(){
  int ret=-1;
  while(ret==-1){
    i++;
    s/=step;
    s++;
    ret=ask();
  }
  a=s+i; b=s*step+i;

  while(b-a){
    i++;
    ask2();
  }
  printf("! %d\n",a);
  return 0;
}


/// confirm df==0 ///

0