結果
| 問題 |
No.246 質問と回答
|
| コンテスト | |
| ユーザー |
spade630
|
| 提出日時 | 2015-10-19 11:49:54 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 342 bytes |
| コンパイル時間 | 544 ms |
| コンパイル使用メモリ | 53,980 KB |
| 実行使用メモリ | 43,040 KB |
| 最終ジャッジ日時 | 2024-07-16 19:56:09 |
| 合計ジャッジ時間 | 6,817 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 29 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%d", &res);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include <iostream>
#include <cstdio>
using namespace std;
const int INF = 1e+9;
int main() {
int lb = 0, ub = INF, res;
while(ub - lb > 1){
int mid = (lb + ub) / 2;
printf("? %d\n", mid);
fflush(stdin);
scanf("%d", &res);
if(res){
lb = mid;
}
else{
ub = mid;
}
}
printf("! %d\n", ub);
fflush(stdin);
return 0;
}
spade630