Regular Triangle Inside a Rectangle

AtCoder
IDabc292_f
Time2000ms
Memory256MB
Difficulty
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$ [samples]
Samples
Input #1
1 1
Output #1
1.03527618041008295791

The following figure shows an optimal drawing, with the side length of $\sqrt{6} - \sqrt{2}$.
![image](https://img.atcoder.jp/abc292/2cd44ddc3d8241e510a356be9533631f.png)
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.
API Response (JSON)
{
  "problem": {
    "name": "Regular Triangle Inside a Rectangle",
    "description": {
      "content": "Find the maximum side length of a regular triangle that can be drawn within a rectangle whose side lengths are $A$ and $B$.",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc292_f"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Find the maximum side length of a regular triangle that can be drawn within a rectangle whose side lengths are $A$ and $B$.\n\n## Constraints\n\n*   $1 \\leq A,B \\leq 1000$\n*   $A$ and $B$ are integers.\n\n#...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments