結果
問題 | No.246 質問と回答 |
ユーザー |
![]() |
提出日時 | 2015-10-19 11:45:54 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 308 bytes |
コンパイル時間 | 653 ms |
コンパイル使用メモリ | 54,164 KB |
実行使用メモリ | 43,044 KB |
最終ジャッジ日時 | 2024-07-16 19:55:55 |
合計ジャッジ時間 | 6,886 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 29 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:12:25: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘int’ [-Wformat=] 12 | scanf("%d", res); | ~^ ~~~ | | | | | int | int* main.cpp:12:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d", res); | ~~~~~^~~~~~~~~~~ main.cpp:12:22: warning: ‘res’ is used uninitialized [-Wuninitialized] 12 | 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);scanf("%d", res);if(res){lb = mid;}else{ub = mid;}}printf("! %d\n", ub);return 0;}