結果
| 問題 |
No.246 質問と回答
|
| コンテスト | |
| ユーザー |
YOS G-spec
|
| 提出日時 | 2018-10-17 23:32:09 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 293 bytes |
| コンパイル時間 | 160 ms |
| コンパイル使用メモリ | 22,400 KB |
| 実行使用メモリ | 43,044 KB |
| 最終ジャッジ日時 | 2024-07-16 16:15:56 |
| 合計ジャッジ時間 | 6,495 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 29 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | int v; scanf("%d",&v);
| ~~~~~^~~~~~~~~
ソースコード
#include <stdio.h>
int main(){
int numMin=1;
int numMax=1000000001;
for(;;){
int chkNum=(numMin+numMax)/2;
printf("? %d\n",chkNum);
int v; scanf("%d",&v);
if(v==1) numMin=chkNum; else numMax=chkNum;
if(numMin==numMax-1){
printf("! %d\n",numMin);
break;
}
}
return 0;
}
YOS G-spec