結果

問題 No.1381 Simple Geometry 1
ユーザー さかぽんさかぽん
提出日時 2021-02-17 09:21:44
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 745 bytes
コンパイル時間 4,995 ms
コンパイル使用メモリ 103,948 KB
実行使用メモリ 26,964 KB
最終ジャッジ日時 2023-10-11 20:58:37
合計ジャッジ時間 8,563 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
22,816 KB
testcase_01 AC 65 ms
22,764 KB
testcase_02 AC 64 ms
24,948 KB
testcase_03 AC 63 ms
22,860 KB
testcase_04 AC 64 ms
22,728 KB
testcase_05 AC 64 ms
22,828 KB
testcase_06 AC 65 ms
22,908 KB
testcase_07 AC 64 ms
20,928 KB
testcase_08 AC 65 ms
24,980 KB
testcase_09 AC 64 ms
22,880 KB
testcase_10 AC 64 ms
24,760 KB
testcase_11 AC 63 ms
20,704 KB
testcase_12 AC 65 ms
24,988 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

class B
{
	static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
	static (int, int, int, int) Read4() { var a = Read(); return (a[0], a[1], a[2], a[3]); }
	static void Main()
	{
		var (x, y, z, w) = Read4();

		var bq = First(0, x, bq_ =>
		{
			var bp_ = bq_ + w;
			return (bp_ * bp_ - y * y) * (bq_ * bq_ - z * z) >= x * x;
		});

		var bp = bq + w;
		var ab = Math.Sqrt(bp * bp - y * y);
		var bc = Math.Sqrt(bq * bq - z * z);

		Console.WriteLine(x - (ab * y + bc * z + (ab - z) * (bc - y)) / 2);
	}

	static double First(double l, double r, Func<double, bool> f, int digits = 9)
	{
		double m;
		while (Math.Round(r - l, digits) > 0) if (f(m = l + (r - l) / 2)) r = m; else l = m;
		return r;
	}
}
0