問題一覧 > 通常問題

No.98 Let's Draw a Circle

レベル : / AI推定難易度 : 137 / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 619
作問者 : nmnmnmnmnmnmnm
お気に入りにしたユーザー ProblemId : 224 / 自分の提出
問題文最終更新日: 2020-01-17 17:26:23
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 63 (順位表) の他の問題:

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.

(Hint: Use the Pythagorean theorem.)

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もしくは右上の雲マークをクリックしてアカウントを作成してください。