結果
問題 | No.513 宝探し2 |
ユーザー |
![]() |
提出日時 | 2017-05-05 22:41:04 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 25 ms / 2,000 ms |
コード長 | 404 bytes |
コンパイル時間 | 315 ms |
コンパイル使用メモリ | 23,168 KB |
実行使用メモリ | 25,476 KB |
平均クエリ数 | 3.50 |
最終ジャッジ日時 | 2024-07-17 00:57:56 |
合計ジャッジ時間 | 1,404 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
コンパイルメッセージ
main.cpp: In function ‘int ask(int, int)’: main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d", &d); | ~~~~~^~~~~~~~~~
ソースコード
#include<cstdio>int 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(100000, 0);if(d2==0) break;d3=ask(0, 100000);if(d3==0) break;x=(d+d3-100000)/2;y=(d+d2-100000)/2;if(ask(x, y)==0) return 0;}return 0;}