[COCI2006-2007#1] Herman

洛谷: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 T_{1}(x_{1},y_{1}) and T_{2}(x_{2},y_{2}) is defined as: D\left ( T_{1},T_{2} \right )=\left | x_{1}-x_{2} \right |+\left | y_{1}-y_{2} \right | 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)研究了一種名爲出租車幾何學的非歐幾何。 在出租車幾何裏T_{1}(x_{1},y_{1}),T_{2}(x_{2},y_{2})兩點之間的距離被定義爲dis\left ( T_{1},T_{2} \right )=\left | x_{1}-x_{2} \right |+\left | y_{1}-y_{2} \right |(曼哈頓距離)。 其他定義均與歐幾里得幾何相同。
例如圓的定義:在同一平面內,到定點(圓心)的距離等於定長(半徑)的點的集合。

我們對歐幾里得幾何與出租車幾何兩種定義下半徑爲R的圓的面積很感興趣。解決這個問題的重擔就落在你身上了。

輸入輸出格式

輸入格式

僅有一行爲圓的半徑R。 (R≤10000)

輸出格式

第一行輸出歐幾里得幾何下半徑爲R的圓的面積,第二行輸出出租車幾何下半徑爲R的圓的面積。

注意:你的輸出與標準答案絕對誤差不超過0.0001將會被認爲正確

輸入輸出樣例

輸入樣例     21

輸出樣例

1385.442360
882.000000

解釋

我們假設R=3

衆所周知歐幾里得幾何中的圓長這樣:

圓 - 歐幾里得幾何

那麼出租車幾何中的圓呢?

我們來看一下:

歐幾里得幾何中距離公式爲dis\left ( T_{1},T_{2} \right )=\sqrt{\left ( x^{_{1}}-x_{2} \right )^{2}+\left ( y^{_{1}}-y_{2} \right )^{2}},所以標準圓的面積表示爲S_{1}=x^{2}+y^{2}

而出租車幾何中距離公式爲dis\left ( T_{1},T_{2} \right )=\left | x_{1}-x_{2} \right |+\left | y_{1}-y_{2} \right |,所以標準圓的面積表示爲S_{2}=\left | x \right |+\left | y \right |

你沒有看錯!這個“圓”居然是正方形!

圓 - 出租車幾何

這麼鬼畜的圓我還是頭一回見。。。

(本來還以爲是考第二定義啥的呢)

那就真相大白了

# -*- 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)

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章