Manhattan
InterviewTime limit1sMemory limit512 MB
Given the Euclidean distance between two grid-aligned houses, find the maximum Manhattan distance achievable between them.
- Level
Easy3 of 10
- Topics
- Geometry, Math, Implementation
- Solved
- No attempts yet
Problem
In Manhattan, there are streets and for every integer . Both Snuke's house and Smeke's house lie on streets, and the Euclidean distance between them is exactly . Find the largest possible distance between their houses when they travel along streets.
Input
The input consists of a single number .
- has exactly three digits after the decimal point.
Output
Print the answer. The answer is considered correct if its absolute or relative error is at most .