結果

問題 No.1429 Simple Dowsing
ユーザー CleyLCleyL
提出日時 2022-01-21 00:24:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 771 bytes
コンパイル時間 573 ms
コンパイル使用メモリ 65,264 KB
実行使用メモリ 24,384 KB
平均クエリ数 2.93
最終ジャッジ日時 2023-08-16 01:47:06
合計ジャッジ時間 2,287 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
24,084 KB
testcase_01 AC 23 ms
24,000 KB
testcase_02 AC 23 ms
24,384 KB
testcase_03 AC 23 ms
23,844 KB
testcase_04 AC 23 ms
23,436 KB
testcase_05 AC 23 ms
23,652 KB
testcase_06 AC 23 ms
24,264 KB
testcase_07 AC 24 ms
23,436 KB
testcase_08 AC 24 ms
24,348 KB
testcase_09 AC 24 ms
23,856 KB
testcase_10 AC 24 ms
23,388 KB
testcase_11 AC 23 ms
24,048 KB
testcase_12 AC 23 ms
23,676 KB
testcase_13 AC 24 ms
23,628 KB
testcase_14 AC 24 ms
23,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main(){
    cout << "? 0 0" << endl;
    int x,y;cin>>x;
    if(x == 0){
      cout << "! 0 0" << endl;
      return 0;
    }
    bool yet = false;
    int p,q;
    for(int i = 0; 100 >= i; i++){
        for(int j = 0; 100 >= j; j++){
            if(i*i+j*j == x && yet && (p-i)*(p-i)+(q-j)*(q-j) == y){
                cout << "! " << i << " " << j << endl;
                return 0;
            }else if(i*i+j*j == x && !yet){
                cout << "? " << i << " " << j << endl;
                cin>>y;
                if(y==0){
                  cout << "! " << i << " " << j << endl;
                  return 0;
                }
                p=i;q=j;
                yet = true;
            }
        }
    }
    
}
0