結果
| 問題 |
No.1429 Simple Dowsing
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2021-03-14 23:32:30 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 2,000 ms |
| コード長 | 984 bytes |
| コンパイル時間 | 902 ms |
| コンパイル使用メモリ | 93,948 KB |
| 実行使用メモリ | 25,288 KB |
| 平均クエリ数 | 3.00 |
| 最終ジャッジ日時 | 2024-07-17 10:57:12 |
| 合計ジャッジ時間 | 2,223 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 1429.cc: No.1429 Simple Dowsing - yukicoder
*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
/* constant */
const int MAX_P = 100;
const int MAX_Q = 100;
/* typedef */
/* global variables */
int query(int p, int q) {
printf("? %d %d\n", p, q); fflush(stdout);
int d;
scanf("%d", &d);
return d;
}
int d2(int dx, int dy) { return dx * dx + dy * dy; }
/* subroutines */
/* main */
int main() {
int d0 = query(0, 0);
int d1 = query(MAX_P, 0);
for (int x = 0; x <= MAX_P; x++)
for (int y = 0; y <= MAX_Q; y++)
if (d2(x, y) == d0 && d2(x - MAX_P, y) == d1) {
printf("! %d %d\n", x, y); fflush(stdout);
return 0;
}
return 0;
}
tnakao0123