結果

問題 No.1429 Simple Dowsing
ユーザー kikage
提出日時 2021-08-12 16:19:13
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 384 bytes
コンパイル時間 828 ms
コンパイル使用メモリ 81,500 KB
最終ジャッジ日時 2025-01-23 17:45:37
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

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