結果
問題 | No.246 質問と回答 |
ユーザー |
|
提出日時 | 2020-04-26 02:50:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 62 ms / 2,000 ms |
コード長 | 298 bytes |
コンパイル時間 | 2,183 ms |
コンパイル使用メモリ | 190,220 KB |
最終ジャッジ日時 | 2025-01-10 01:47:42 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:13:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | int x; scanf("%d",&x); | ~~~~~^~~~~~~~~
ソースコード
#include <bits/stdc++.h>#define rep(i,n) for(int i=0;i<(n);i++)using namespace std;int main(){int lo=1,hi=1e9+1;while(hi-lo>1){int mi=(lo+hi)/2;printf("? %d\n",mi);fflush(stdout);int x; scanf("%d",&x);if(x==1) lo=mi;else hi=mi;}printf("! %d\n",lo);return 0;}