Taxicab Geometry
Time limit1sMemory limit128 MB
Given radius R, compute and print the area of a Euclidean circle and a taxicab-metric circle.
- Level
Easy1 of 10
- Topics
- Math, Geometry, Implementation
- Solved
- No attempts yet
Problem
In the 19th century, German mathematician Hermann Minkowski introduced taxicab geometry, a form of non-Euclidean geometry.
In taxicab geometry, the distance between two points T1(x1, y1) and T2(x2, y2) is defined as follows.
D(T1, T2) = |x1 - x2| + |y1 - y2|
Except for the distance between two points, all other definitions are the same as in Euclidean geometry. Therefore, a circle in taxicab geometry is also defined as follows.
Circle: the set of all points in a plane that are at a constant distance from a fixed point
Given a radius R, write a program that computes the area of a circle in Euclidean geometry and the area of a circle in taxicab geometry.
Input
The first line contains the radius R. R is a natural number not greater than 10,000.
Output
On the first line, print the area of a circle with radius R in Euclidean geometry.
On the second line, print the area of a circle with radius R in taxicab geometry.
An absolute or relative error up to 0.0001 is accepted.
Hint
References:
- Euclidean geometry: Korean Wikipedia, English Wikipedia, Wolfram MathWorld
- Non-Euclidean geometry: Korean Wikipedia, English Wikipedia, Wolfram MathWorld
- Taxicab geometry: Korean Wikipedia, English Wikipedia, Wolfram MathWorld