No.98 Let's Draw a Circle
タグ : / 解いたユーザー数 619
作問者 :
nmnmnmnmnmnmnm
Problem Statement
A-kun is going to draw a circle.
The circle must satisfy the following conditions.
・The center of the circle is at the origin of the XY plane.
・The diameter of the circle must be an integer.
・The given point P($Xp$,$Yp$) with integer coordinates must be inside the circle.
Here, inside means strictly inside the circle, not overlapping the circle's line.
Find the minimum diameter of a circle that can be drawn.
Input
Xp Yp
$Xp$ and $Yp$ of the coordinates ($Xp$,$Yp$) of point P are given.
$Xp$,$Yp$ are both integers. ($-10000 \le Xp,Yp \le 10000$)
Output
Output the minimum diameter of a circle that can be drawn, on one line.
Do not forget the newline at the end.
Sample
Sample 1
Input
3 0
Output
7
If a circle of diameter 6 is drawn, it overlaps point P.
Therefore, by drawing a circle of diameter 7, point P can be placed inside the circle.
Sample 2
Input
-3 4
Output
11
If a circle of diameter 10 is drawn, it overlaps point P.
Therefore, by drawing a circle of diameter 11, point P can be placed inside the circle.
Sample 3
Input
4 4
Output
12
Point P($4$,$4$) can be placed inside by drawing a circle of diameter $12$.
Sample 4
Input
0 0
Output
1
Since point P is the origin, it can be placed inside by drawing a circle of diameter $1$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。