結果
| 問題 | No.246 質問と回答 |
| コンテスト | |
| ユーザー |
Bantako
|
| 提出日時 | 2017-07-26 11:08:16 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 352 bytes |
| 記録 | |
| コンパイル時間 | 1,223 ms |
| コンパイル使用メモリ | 157,124 KB |
| 実行使用メモリ | 25,604 KB |
| 平均クエリ数 | 27.50 |
| 最終ジャッジ日時 | 2024-07-16 13:59:21 |
| 合計ジャッジ時間 | 4,771 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 WA * 21 |
コンパイルメッセージ
main.cpp:2:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
2 | main(){
| ^~~~
main.cpp: In function ‘int main()’:
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d",&ans);
| ~~~~~^~~~~~~~~~~
ソースコード
#include<bits/stdc++.h>
main(){
int min = 0,max = 100000000;
while(min!=max){
printf("? %d\n",(min+max)/2);
fflush(stdout);
int ans;
scanf("%d",&ans);
if(ans){
min = (min+max+1)/2;
}else{
max = (min+max-1)/2;
}
}
printf("! %d\n",min);
fflush(stdout);
}
Bantako