結果
| 問題 | No.246 質問と回答 |
| コンテスト | |
| ユーザー |
mban
|
| 提出日時 | 2017-01-04 02:13:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 295 bytes |
| 記録 | |
| コンパイル時間 | 293 ms |
| コンパイル使用メモリ | 22,400 KB |
| 実行使用メモリ | 25,660 KB |
| 平均クエリ数 | 31.00 |
| 最終ジャッジ日時 | 2024-07-16 12:09:06 |
| 合計ジャッジ時間 | 3,598 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 30 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:14:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%d", &r);
| ~~~~~^~~~~~~~~~
ソースコード
#include<stdio.h>
int plus = 1 << 30;
int ans = 0;
int main(void) {
int i;
int w;
int r;
for (i = 0; i < 30; i++) {
plus /= 2;
w = ans + plus;
printf("? %d\n", w);
fflush(0);
scanf("%d", &r);
if (r == 0) {
ans = w;
}
}
printf("! %d\n", ans+1);
fflush(0);
return 0;
}
mban