結果

問題 No.1429 Simple Dowsing
ユーザー kpinkcatkpinkcat
提出日時 2023-09-09 13:24:36
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 622 bytes
コンパイル時間 1,843 ms
コンパイル使用メモリ 192,072 KB
最終ジャッジ日時 2025-02-16 20:37:29
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:29:26: warning: ‘x’ may be used uninitialized [-Wmaybe-uninitialized]
   29 |     cout << "! " << x << " " << y << endl;
      |                          ^~~
main.cpp:17:17: note: ‘x’ was declared here
   17 |     int d1, d2, x, y;
      |                 ^
main.cpp:29:33: warning: ‘y’ may be used uninitialized [-Wmaybe-uninitialized]
   29 |     cout << "! " << x << " " << y << endl;
      |                                 ^
main.cpp:17:20: note: ‘y’ was declared here
   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