class
GFG{
static
class
pair
{
float
first;
float
second;
public
pair(
float
first,
float
second)
{
this
.first = first;
this
.second = second;
}
}
static
float
distance(
float
x1,
float
y1,
float
x2,
float
y2)
{
return
(
float
) Math.sqrt((x2 - x1) * (x2 - x1)
+ (y2 - y1) * (y2 - y1));
}
static
void
lengthOfLatusRectum(
float
a,
float
b,
float
c)
{
pair vertex
=
new
pair( (-b / (
2
* a)),
(((
4
* a * c) - (b * b)) / (
4
* a)) );
pair focus
=
new
pair( (-b / (
2
* a)),
(((
4
* a * c) - (b * b) +
1
) / (
4
* a)) );
System.out.print(
4
* distance(
(
float
)focus.first, (
float
)focus.second,
(
float
)vertex.first, (
float
)vertex.second));
}
public
static
void
main(String[] args)
{
float
a =
3
, b =
5
, c =
1
;
lengthOfLatusRectum(a, b, c);
}
}