結果
問題 | No.514 宝探し3 |
ユーザー |
![]() |
提出日時 | 2017-05-05 22:43:12 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 22 ms / 2,000 ms |
コード長 | 435 bytes |
コンパイル時間 | 178 ms |
コンパイル使用メモリ | 23,040 KB |
実行使用メモリ | 25,604 KB |
平均クエリ数 | 3.50 |
最終ジャッジ日時 | 2024-07-16 12:59:33 |
合計ジャッジ時間 | 1,397 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
コンパイルメッセージ
main.cpp: In function ‘int ask(int, int)’: main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d", &d); | ~~~~~^~~~~~~~~~
ソースコード
#include<cstdio>#define NUM_MAX 1000000000int ask(int x, int y){int d;printf("%d %d\n", x, y);fflush(stdout);scanf("%d", &d);return d;}int main(void){int i;int x, y;int d, d2, d3;for(i=0;i<25;i++){d=ask(0, 0);if(d==0) break;d2=ask(NUM_MAX, 0);if(d2==0) break;d3=ask(0, NUM_MAX);if(d3==0) break;x=(d+d3-NUM_MAX)/2;y=(d+d2-NUM_MAX)/2;if(ask(x, y)==0) return 0;}return 0;}