結果
| 問題 |
No.3212 SUPER Guess the Number
|
| コンテスト | |
| ユーザー |
pengin_2000
|
| 提出日時 | 2025-07-25 22:52:46 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 618 bytes |
| コンパイル時間 | 1,431 ms |
| コンパイル使用メモリ | 26,832 KB |
| 実行使用メモリ | 25,972 KB |
| 平均クエリ数 | 25.50 |
| 最終ジャッジ日時 | 2025-07-25 22:52:51 |
| 合計ジャッジ時間 | 2,488 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 WA * 8 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:19:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
19 | scanf("%lld", &res);
| ^~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
int main()
{
long long int i;
long long int x[32], xx;
long long int min, mid, max;
min = 0;
max = 1e6;
printf("? -100000000\n");
fflush(stdout);
x[0] = -1e8;
long long int res;
for (xx = 1; max - min > 1; xx++)
{
mid = (max + min) / 2;
x[xx] = 2 * mid - x[xx - 1];
printf("? %lld\n", x[xx]);
fflush(stdout);
scanf("%lld", &res);
if (res < 0)
return 0;
if (x[xx - 1] < min)
{
if (res > 0)
min = mid - 1;
else
max = mid;
}
else
{
if (res == 0)
min = mid - 1;
else
max = mid;
}
}
printf("! %lld\n", max);
fflush(stdout);
return 0;
}
pengin_2000