結果
| 問題 |
No.246 質問と回答
|
| コンテスト | |
| ユーザー |
latte0119
|
| 提出日時 | 2015-08-06 11:57:13 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 52 ms / 2,000 ms |
| コード長 | 339 bytes |
| コンパイル時間 | 1,384 ms |
| コンパイル使用メモリ | 156,996 KB |
| 実行使用メモリ | 25,220 KB |
| 平均クエリ数 | 30.87 |
| 最終ジャッジ日時 | 2024-07-16 19:53:58 |
| 合計ジャッジ時間 | 4,550 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:18:12: warning: unknown escape sequence: '\040'
18 | printf("! %d\ ",lb);
| ^~~~~~~~
main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%d",&res);
| ~~~~~^~~~~~~~~~~
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
int lb=0,ub=1e9+1;
while(ub-lb>1){
int mid=(ub+lb)/2;
printf("? %d\n",mid);
fflush(stdout);
int res;
scanf("%d",&res);
if(res)lb=mid;
else ub=mid;
}
printf("! %d\ ",lb);
fflush(stdout);
return 0;
}
latte0119