結果

問題 No.1429 Simple Dowsing
ユーザー kpinkcatkpinkcat
提出日時 2023-09-09 13:24:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 622 bytes
コンパイル時間 2,237 ms
コンパイル使用メモリ 197,696 KB
実行使用メモリ 24,228 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-09 13:24:43
合計ジャッジ時間 4,088 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
23,400 KB
testcase_01 AC 22 ms
23,412 KB
testcase_02 AC 23 ms
23,484 KB
testcase_03 AC 23 ms
23,652 KB
testcase_04 AC 23 ms
23,532 KB
testcase_05 AC 23 ms
23,556 KB
testcase_06 AC 23 ms
23,664 KB
testcase_07 AC 22 ms
23,556 KB
testcase_08 AC 23 ms
23,352 KB
testcase_09 AC 23 ms
23,652 KB
testcase_10 AC 23 ms
24,228 KB
testcase_11 AC 23 ms
23,376 KB
testcase_12 AC 23 ms
24,012 KB
testcase_13 AC 22 ms
23,388 KB
testcase_14 AC 22 ms
23,544 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:29:33: 警告: ‘y’ may be used uninitialized [-Wmaybe-uninitialized]
   29 |     cout << "! " << x << " " << y << endl;
      |                                 ^
main.cpp:17:20: 備考: ‘y’ はここで定義されています
   17 |     int d1, d2, x, y;
      |                    ^
main.cpp:29:26: 警告: ‘x’ may be used uninitialized [-Wmaybe-uninitialized]
   29 |     cout << "! " << x << " " << y << endl;
      |                          ^~~
main.cpp:17:17: 備考: ‘x’ はここで定義されています
   17 |     int d1, d2, x, y;
      |                 ^

ソースコード

diff #

#include <bits/stdc++.h>
#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
#include<string>
using ll = long long;
using namespace std;

int main()
{
    cout << "? 0 0" << endl;
    int d1, d2, x, y;
    cin >> d1;
    cout << "? 0 100" << endl;
    cin >> d2;
    for (int i = 0; i <= 100; i++){
        for (int j = 0; j <= 100; j++){
            if ((i*i + j*j == d1) && (i*i + (100 - j)*(100 - j) == d2)){
                x = i;
                y = j;
            }
        }
    }
    cout << "! " << x << " " << y << endl;
}

0