|
I I U P C 2 0 0 6 |
|
|
Problem I: IIUC HexWorld |
|
|
Input: standard input Output: standard output |
|
|
|
|
|
Alice and Bob reside in Independent Impeccable United Countries (IIUC) – a land of the free. There, all the houses are placed in a hexagonal grid. The king’s palace is numbered 0 and all others are numbered 1, 2, 3 ... spirally keeping the king’s palace at the center. There is a single street, starting at king’s palace and built like a spiral, touching the houses 1, 2, 3 ... sequentially. The following picture shows the first few houses and the street in heavy dark line.
Alice lives in house A and Bob
lived in house B. When |
|
|
Input |
|
|
On each line, there will be a pair of integers, A and B. |
|
|
Output |
|
|
For each line of input, print the distance covered by Alice and Bob respectively, with three digits after decimal point. |
|
|
Constraints |
|
|
- 0
≤ A, B ≤ 107 |
|
|
Sample
Input |
Output
for Sample Input |
|
1 2 |
1.000 1.000 |
|
|
|
|
Problemsetter: Mushfiqur Rouf |
|