結果
| 問題 |
No.1429 Simple Dowsing
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-14 16:18:51 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 49 ms / 2,000 ms |
| コード長 | 540 bytes |
| コンパイル時間 | 1,975 ms |
| コンパイル使用メモリ | 111,764 KB |
| 実行使用メモリ | 42,444 KB |
| 平均クエリ数 | 3.00 |
| 最終ジャッジ日時 | 2024-07-17 10:55:54 |
| 合計ジャッジ時間 | 2,632 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
class A
{
static int Query(int i, int j)
{
Console.WriteLine($"? {i} {j}");
return int.Parse(Console.ReadLine());
}
static void Main() => Console.WriteLine($"! {Solve()}");
static object Solve()
{
var d1 = Query(0, 0);
var d2 = Query(0, 100);
int Distance2(int x, int y) => x * x + y * y;
for (int i = 0; i <= 100; i++)
{
for (int j = 0; j <= 100; j++)
{
if (Distance2(i, j) == d1 && Distance2(i, j - 100) == d2)
return $"{i} {j}";
}
}
throw new InvalidOperationException();
}
}