結果

問題 No.1429 Simple Dowsing
ユーザー さかぽんさかぽん
提出日時 2021-03-14 16:18:51
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 3,447 ms
コンパイル使用メモリ 105,532 KB
実行使用メモリ 38,992 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-24 10:08:09
合計ジャッジ時間 5,564 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
38,920 KB
testcase_01 AC 82 ms
37,036 KB
testcase_02 AC 81 ms
36,932 KB
testcase_03 AC 82 ms
38,408 KB
testcase_04 AC 81 ms
38,772 KB
testcase_05 AC 81 ms
36,436 KB
testcase_06 AC 81 ms
36,396 KB
testcase_07 AC 81 ms
36,612 KB
testcase_08 AC 82 ms
37,008 KB
testcase_09 AC 81 ms
38,992 KB
testcase_10 AC 82 ms
36,872 KB
testcase_11 AC 81 ms
37,008 KB
testcase_12 AC 80 ms
36,728 KB
testcase_13 AC 80 ms
36,948 KB
testcase_14 AC 80 ms
38,904 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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();
	}
}
0