結果

問題 No.1793 実数当てゲーム
ユーザー tailstails
提出日時 2021-12-22 01:13:56
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 458 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 28,916 KB
実行使用メモリ 24,288 KB
平均クエリ数 2230.56
最終ジャッジ日時 2023-10-13 20:28:20
合計ジャッジ時間 3,541 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
24,024 KB
testcase_01 AC 26 ms
23,928 KB
testcase_02 AC 108 ms
23,520 KB
testcase_03 AC 107 ms
24,288 KB
testcase_04 AC 108 ms
23,508 KB
testcase_05 AC 95 ms
23,424 KB
testcase_06 AC 96 ms
23,520 KB
testcase_07 AC 100 ms
23,616 KB
testcase_08 AC 102 ms
23,268 KB
testcase_09 AC 97 ms
23,280 KB
testcase_10 AC 101 ms
23,388 KB
testcase_11 AC 100 ms
24,156 KB
testcase_12 AC 108 ms
23,544 KB
testcase_13 AC 113 ms
23,424 KB
testcase_14 AC 114 ms
23,652 KB
testcase_15 AC 108 ms
23,364 KB
testcase_16 AC 114 ms
23,304 KB
testcase_17 AC 111 ms
23,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <math.h>

int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		double lo=-1e5;
		double hi=log(12.22e74)/log(1+1e-5);
		for(int i=25;i--;){
			double m=(lo+hi)/2;
			double y;
			if(m>=0){
				y=pow(1+1e-5,m);
			}else{
				y=1.0+m*1e-5;
			}
			printf("%c %.8f\n",i?'?':'!',y);
			fflush(stdout);
			if(i){
				char res[8];
				scanf("%s",res);
				if(res[0]=='Y'){
					lo=m;
				}else{
					hi=m;
				}
			}
		}
	}
	return 0;
}
0