結果

問題 No.1429 Simple Dowsing
ユーザー hatsuka_iwa
提出日時 2021-03-18 23:52:37
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 541 bytes
コンパイル時間 1,828 ms
コンパイル使用メモリ 167,100 KB
実行使用メモリ 25,592 KB
平均クエリ数 3.00
最終ジャッジ日時 2024-07-17 11:04:07
合計ジャッジ時間 2,950 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  int dist;
  cout << "? 0 0" << endl;
  cin >> dist;

  for (int i = 0; i < 101; i++) {
    for (int j = 0; j < 101; j++) {
      
      if (i * i + j * j == dist) {
        cout << '?' << ' ' << i << ' ' << j << endl;
        cin >> dist;

        if (dist == 0) {
          cout << '!' << ' ' << i << ' ' << j << endl;
          return 0;
        }
        else {
          cout << '!' << ' ' << j << ' ' << i << endl;
          return 0;
        }
        
      }
    }
  }
}
0