結果

問題 No.1429 Simple Dowsing
ユーザー kikagekikage
提出日時 2021-08-12 16:19:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 384 bytes
コンパイル時間 801 ms
コンパイル使用メモリ 83,756 KB
実行使用メモリ 25,208 KB
平均クエリ数 3.00
最終ジャッジ日時 2024-04-09 20:40:39
合計ジャッジ時間 2,172 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
24,568 KB
testcase_01 AC 19 ms
24,824 KB
testcase_02 AC 18 ms
24,824 KB
testcase_03 AC 19 ms
24,568 KB
testcase_04 AC 19 ms
24,568 KB
testcase_05 AC 18 ms
24,952 KB
testcase_06 AC 18 ms
24,952 KB
testcase_07 AC 19 ms
25,208 KB
testcase_08 AC 19 ms
24,836 KB
testcase_09 AC 20 ms
24,952 KB
testcase_10 AC 17 ms
24,952 KB
testcase_11 AC 17 ms
24,568 KB
testcase_12 AC 18 ms
24,824 KB
testcase_13 AC 18 ms
25,208 KB
testcase_14 AC 18 ms
25,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main(void){
    int d[2],x,y;
    cout << "? 0 0" << endl << flush;
    cin >> d[0];
    cout << "? 1 0" << endl << flush;
    cin >> d[1];
// x^2+y^2=d[0],x^2-2*x+1+y^2=d[1]
    x = (d[0]-d[1]+1)/2;
    y = sqrt(d[0]-x*x);
    cout << "! "+to_string(x)+" "+to_string(y) << endl <<flush;
    return 0;
}
0