結果
| 問題 |
No.246 質問と回答
|
| コンテスト | |
| ユーザー |
184
|
| 提出日時 | 2015-07-17 22:44:53 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 389 bytes |
| コンパイル時間 | 371 ms |
| コンパイル使用メモリ | 38,656 KB |
| 実行使用メモリ | 43,044 KB |
| 最終ジャッジ日時 | 2024-07-16 19:41:24 |
| 合計ジャッジ時間 | 6,660 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 29 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:16:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
16 | scanf("%d",&res);
| ~~~~~^~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
//namaega184
int main(){
int left=0,right=1000000000,mid=0;
while(left<right){
mid=(left+right)/2;
printf("? %d\n",mid);
fflush(stdout);
int res;
scanf("%d",&res);
if(res){
left=mid;
}
else{
right=mid-1;
}
}
printf("! %d\n",mid);
fflush(stdout);
return 0;
}
184