結果

問題 No.1429 Simple Dowsing
ユーザー 👑 CleyL
提出日時 2022-01-21 00:20:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
QLE  
実行時間 -
コード長 769 bytes
コンパイル時間 737 ms
コンパイル使用メモリ 66,016 KB
実行使用メモリ 25,448 KB
平均クエリ数 2.67
最終ジャッジ日時 2024-11-24 10:57:12
合計ジャッジ時間 2,369 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12 QLE * 3
権限があれば一括ダウンロードができます

ソースコード

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