English · Original
Chinese · Translation
Formal · Original
Igor the analyst has adopted _n_ little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally, and thus he wants to cut the carrot into _n_ pieces of equal area.
Formally, the carrot can be viewed as an isosceles triangle with base length equal to 1 and height equal to _h_. Igor wants to make _n_ - 1 cuts **parallel to the base** to cut the carrot into _n_ pieces. He wants to make sure that all _n_ pieces have the same area. Can you help Igor determine where to cut the carrot so that each piece have equal area?
<center> Illustration to the first example.</center>
## Input
The first and only line of input contains two space-separated integers, _n_ and _h_ (2 ≤ _n_ ≤ 1000, 1 ≤ _h_ ≤ 105).
## Output
The output should contain _n_ - 1 real numbers _x_1, _x_2, ..., _x__n_ - 1. The number _x__i_ denotes that the _i_\-th cut must be made _x__i_ units away from the apex of the carrot. In addition, 0 < _x_1 < _x_2 < ... < _x__n_ - 1 < _h_ must hold.
Your output will be considered correct if absolute or relative error of every number in your output doesn't exceed 10 - 6.
Formally, let your answer be _a_, and the jury's answer be _b_. Your answer is considered correct if .
[samples]
## Note
Definition of isosceles triangle: [https://en.wikipedia.org/wiki/Isosceles_triangle](https://en.wikipedia.org/wiki/Isosceles_triangle).
Igor the analyst has adopted #cf_span[n] little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally, and thus he wants to cut the carrot into #cf_span[n] pieces of equal area.
Formally, the carrot can be viewed as an isosceles triangle with base length equal to #cf_span[1] and height equal to #cf_span[h]. Igor wants to make #cf_span[n - 1] cuts *parallel to the base* to cut the carrot into #cf_span[n] pieces. He wants to make sure that all #cf_span[n] pieces have the same area. Can you help Igor determine where to cut the carrot so that each piece have equal area?
The first and only line of input contains two space-separated integers, #cf_span[n] and #cf_span[h] (#cf_span[2 ≤ n ≤ 1000], #cf_span[1 ≤ h ≤ 105]).
The output should contain #cf_span[n - 1] real numbers #cf_span[x1, x2, ..., xn - 1]. The number #cf_span[xi] denotes that the #cf_span[i]-th cut must be made #cf_span[xi] units away from the apex of the carrot. In addition, #cf_span[0 < x1 < x2 < ... < xn - 1 < h] must hold.
Your output will be considered correct if absolute or relative error of every number in your output doesn't exceed #cf_span[10 - 6].
Formally, let your answer be #cf_span[a], and the jury's answer be #cf_span[b]. Your answer is considered correct if .
Definition of isosceles triangle: https://en.wikipedia.org/wiki/Isosceles_triangle.
## Input
The first and only line of input contains two space-separated integers, #cf_span[n] and #cf_span[h] (#cf_span[2 ≤ n ≤ 1000], #cf_span[1 ≤ h ≤ 105]).
## Output
The output should contain #cf_span[n - 1] real numbers #cf_span[x1, x2, ..., xn - 1]. The number #cf_span[xi] denotes that the #cf_span[i]-th cut must be made #cf_span[xi] units away from the apex of the carrot. In addition, #cf_span[0 < x1 < x2 < ... < xn - 1 < h] must hold. Your output will be considered correct if absolute or relative error of every number in your output doesn't exceed #cf_span[10 - 6].Formally, let your answer be #cf_span[a], and the jury's answer be #cf_span[b]. Your answer is considered correct if .
[samples]
## Note
Definition of isosceles triangle: https://en.wikipedia.org/wiki/Isosceles_triangle.
**Definitions**
Let $ n \in \mathbb{Z} $ be the number of equal-area pieces, and $ h \in \mathbb{R}^+ $ be the height of the isosceles triangle (carrot).
The carrot is modeled as an isosceles triangle with base length $ 1 $ and height $ h $.
**Constraints**
$ 2 \leq n \leq 1000 $, $ 1 \leq h \leq 10^5 $
**Objective**
Find $ n-1 $ real numbers $ x_1, x_2, \dots, x_{n-1} $ such that $ 0 < x_1 < x_2 < \dots < x_{n-1} < h $, and cutting the triangle at heights $ x_i $ from the apex (parallel to the base) divides it into $ n $ regions of equal area.
The area of the full triangle is $ A = \frac{1}{2} \cdot 1 \cdot h = \frac{h}{2} $.
Each piece must have area $ \frac{h}{2n} $.
Let $ A(x) $ denote the area of the similar triangle from the apex to height $ x $.
By similarity, $ A(x) = \frac{1}{2} \cdot \left(\frac{x}{h}\right)^2 \cdot 1 \cdot h = \frac{x^2}{2h} $.
For the $ k $-th piece (from the apex) to have area $ \frac{h}{2n} $, the cumulative area up to $ x_k $ must be $ \frac{k h}{2n} $.
Thus,
$$
\frac{x_k^2}{2h} = \frac{k h}{2n}
\quad \Rightarrow \quad
x_k^2 = \frac{k h^2}{n}
\quad \Rightarrow \quad
x_k = h \sqrt{\frac{k}{n}}, \quad \text{for } k = 1, 2, \dots, n-1
$$
**Output**
$$
x_k = h \sqrt{\frac{k}{n}}, \quad k = 1, 2, \dots, n-1
$$
API Response (JSON)
{
"problem": {
"name": "B. Cutting Carrot",
"description": {
"content": "Igor the analyst has adopted _n_ little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally, and",
"description_type": "Markdown"
},
"platform": "Codeforces",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "CF794B"
},
"statements": [
{
"statement_type": "Markdown",
"content": "Igor the analyst has adopted _n_ little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally, and...",
"is_translate": false,
"language": "English"
},
{
"statement_type": "Markdown",
"content": "Igor the analyst has adopted #cf_span[n] little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equa...",
"is_translate": true,
"language": "Chinese"
},
{
"statement_type": "Markdown",
"content": "**Definitions** \nLet $ n \\in \\mathbb{Z} $ be the number of equal-area pieces, and $ h \\in \\mathbb{R}^+ $ be the height of the isosceles triangle (carrot). \n\nThe carrot is modeled as an isosceles tri...",
"is_translate": false,
"language": "Formal"
}
]
}