#P8668. [蓝桥杯 2018 省 B] 螺旋折线
[蓝桥杯 2018 省 B] 螺旋折线
Problem Description
As shown in the figure, the spiral polyline passes through every integer lattice point on the plane exactly once.

For a lattice point , we define its distance to the origin as the length of the spiral polyline segment from the origin to .
For example, , and .
Given the integer coordinates , can you compute ?
Input Format
and .
Output Format
Output .
0 1
3
Hint
For of the testdata, .
For of the testdata, .
For of the testdata, .
Translated by ChatGPT 5