102925: [Atcoder]ABC292 F - Regular Triangle Inside a Rectangle

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:4 Solved:0

Description

Score : $500$ points

Problem Statement

Find the maximum side length of a regular triangle that can be drawn within a rectangle whose side lengths are $A$ and $B$.

Constraints

  • $1 \leq A,B \leq 1000$
  • $A$ and $B$ are integers.

Input

The input is given from Standard Input in the following format:

$A$ $B$

Output

Print the answer.
Your output is considered correct if the absolute or relative error from the true answer is at most $10^{-9}$.


Sample Input 1

1 1

Sample Output 1

1.03527618041008295791

The following figure shows an optimal drawing, with the side length of $\sqrt{6} - \sqrt{2}$.

image

Note that the sample output does not strictly match $\sqrt{6}- \sqrt{2}$, but the error is within $10^{-9}$, so it is considered correct.

Input

题意翻译

给定一个边长为 $a$ 和 $b$ 的矩形,求能放下的边长最长的等边三角形的边长是多少。

Output

分数:500分

问题描述

在一个边长为$A$和$B$的矩形内,找出能够画出的正三角形的最大边长。

限制条件

  • $1 \leq A,B \leq 1000$
  • $A$和$B$都是整数。

输入

输入从标准输入按以下格式给出:

$A$ $B$

输出

打印答案。
如果与真实答案的绝对或相对误差不超过$10^{-9}$,则认为您的输出是正确的。


样例输入 1

1 1

样例输出 1

1.03527618041008295791

下图显示了一个最优的绘制方案,其边长为$\sqrt{6} - \sqrt{2}$。

image

注意,样例输出并不严格等于$\sqrt{6}- \sqrt{2}$,但是误差不超过$10^{-9}$,因此被认为是正确的。

HINT

在一个长为a宽为b的矩形中放入一个正三角形,边长最大是多少?

加入题单

算法标签: