結果
| 問題 |
No.1381 Simple Geometry 1
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-17 09:21:44 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 745 bytes |
| コンパイル時間 | 2,746 ms |
| コンパイル使用メモリ | 106,624 KB |
| 実行使用メモリ | 19,072 KB |
| 最終ジャッジ日時 | 2024-09-13 19:50:21 |
| 合計ジャッジ時間 | 4,536 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 WA * 18 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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;
}
}