洛谷:https://www.luogu.org/problemnew/show/P4326
題目描述
The 19th century German mathematician Hermann Minkowski investigated a non-Euclidian geometry, called the taxicab geometry. In taxicab geometry the distance between two points and is defined as: All other definitions are the same as in Euclidian geometry, including that of a circle: A circle is the set of all points in a plane at a fixed distance (the radius) from a fixed point (the centre of the circle). We are interested in the difference of the areas of two circles with radius R, one of which is in normal (Euclidian) geometry, and the other in taxicab geometry. The burden of solving this difficult problem has fallen onto you.
19世紀的德國數學家赫爾曼·閔可夫斯基(Hermann Minkowski)研究了一種名爲出租車幾何學的非歐幾何。 在出租車幾何裏,兩點之間的距離被定義爲(曼哈頓距離)。 其他定義均與歐幾里得幾何相同。
例如圓的定義:在同一平面內,到定點(圓心)的距離等於定長(半徑)的點的集合。
我們對歐幾里得幾何與出租車幾何兩種定義下半徑爲R的圓的面積很感興趣。解決這個問題的重擔就落在你身上了。
輸入輸出格式
輸入格式
僅有一行爲圓的半徑R。 (R≤10000)
輸出格式
第一行輸出歐幾里得幾何下半徑爲R的圓的面積,第二行輸出出租車幾何下半徑爲R的圓的面積。
注意:你的輸出與標準答案絕對誤差不超過0.0001將會被認爲正確
輸入輸出樣例
輸入樣例 21
輸出樣例
1385.442360
882.000000
解釋
我們假設R=3
衆所周知歐幾里得幾何中的圓長這樣:
那麼出租車幾何中的圓呢?
我們來看一下:
歐幾里得幾何中距離公式爲,所以標準圓的面積表示爲
而出租車幾何中距離公式爲,所以標準圓的面積表示爲
你沒有看錯!這個“圓”居然是正方形!
這麼鬼畜的圓我還是頭一回見。。。
(本來還以爲是考第二定義啥的呢)
那就真相大白了
# -*- coding: utf-8 -*-
import math
R = input()
R = int(R)
s1 = R**2 * math.pi
s2 = R**2 * 2
print('%.6f' % s1)
print('%.6f' % s2)