結果

問題 No.1429 Simple Dowsing
ユーザー oooooba
提出日時 2021-07-18 12:23:51
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 785 bytes
コンパイル時間 871 ms
コンパイル使用メモリ 112,712 KB
最終ジャッジ日時 2025-01-23 03:08:53
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 WA * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:34:27: warning: ‘xa’ may be used uninitialized [-Wmaybe-uninitialized]
   34 |     cout << "? " << xa << " " << xb << endl;
      |                           ^~~
main.cpp:23:13: note: ‘xa’ was declared here
   23 |     int32_t xa, xb;
      |             ^~
main.cpp:34:34: warning: ‘xb’ may be used uninitialized [-Wmaybe-uninitialized]
   34 |     cout << "? " << xa << " " << xb << endl;
      |                                  ^~
main.cpp:23:17: note: ‘xb’ was declared here
   23 |     int32_t xa, xb;
      |                 ^~

ソースコード

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;
    int32_t xa, xb;
    for (auto a = 0; a <= 100; ++a) {
        for (auto b = 0; b <= 100; ++b) {
            if (a * a + b * b == d) {
                xa = a;
                xb = b;
                goto next;
            }
        }
    }
next:
    cout << "? " << xa << " " << xb << endl;
    cin >> d;
    if (d != 0)
        swap(xa, xb);
    cout << "! " << xa << " " << xb << endl;
    return 0;
}
0