結果

問題 No.1429 Simple Dowsing
ユーザー oooooba
提出日時 2021-07-18 12:31:45
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 892 bytes
コンパイル時間 1,115 ms
コンパイル使用メモリ 115,312 KB
最終ジャッジ日時 2025-01-23 03:09:42
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
    cout << "? 0 0" << endl;
    int32_t d;
    cin >> d;
    vector<pair<int32_t, int32_t>> cand;
    for (auto a = 0; a <= 100; ++a) {
        for (auto b = 0; b <= 100; ++b) {
            if (a * a + b * b == d) {
                cand.push_back({a, b});
            }
        }
    }
    cout << "? 100 100" << endl;
    cin >> d;
    for (auto &&p : cand) {
        int32_t ta = 100 - p.first, tb = 100 - p.second;
        if (ta * ta + tb * tb == d) {
            cout << "! " << p.first << " " << p.second << endl;
            break;
        }
    }
    return 0;
}
0