結果
| 問題 |
No.1429 Simple Dowsing
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-18 12:48:13 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 68 ms / 2,000 ms |
| コード長 | 888 bytes |
| コンパイル時間 | 1,029 ms |
| コンパイル使用メモリ | 116,364 KB |
| 最終ジャッジ日時 | 2025-01-23 03:09:46 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 |
ソースコード
#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 0" << endl;
cin >> d;
for (auto &&p : cand) {
int32_t ta = 100 - p.first, tb = 0 - p.second;
if (ta * ta + tb * tb == d) {
cout << "! " << p.first << " " << p.second << endl;
break;
}
}
return 0;
}