結果
| 問題 | No.246 質問と回答 |
| コンテスト | |
| ユーザー |
mban
|
| 提出日時 | 2017-01-04 01:58:55 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 283 bytes |
| 記録 | |
| コンパイル時間 | 118 ms |
| コンパイル使用メモリ | 20,480 KB |
| 実行使用メモリ | 25,604 KB |
| 平均クエリ数 | 31.00 |
| 最終ジャッジ日時 | 2024-07-16 12:08:52 |
| 合計ジャッジ時間 | 3,606 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 30 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:14:17: warning: ignoring return value of ‘scanf’ 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);
return 0;
}
mban