落谷-P4326 [COCI2006-2007#1] Herman

题目描述
The 19th century German mathematician Hermann Minkowski investigated a non-Euclidian geometry, called the taxicab geometry. In taxicab geometry the distance between two points T1(x1, y1) and T2(x2, y2) is defined as: D(T1,T2) = |x1 - x2| + |y1 - y2| 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.

输入输出格式
输入格式:
The first and only line of input will contain the radius R, an integer smaller than or equal to 10000.

输出格式:
On the first line you should output the area of a circle with radius R in normal (Euclidian) geometry. On the second line you should output the area of a circle with radius R in taxicab geometry. Note: Outputs within ±0.0001 of the official solution will be accepted.

输入:
1
输出:
3.141593
2.000000

输入:
21
输出:
1385.442360
882.000000
输入:
42
5541.769441
3528.000000

怎样求取在曼哈顿距离上的圆的面积。

#include<bits/stdc++.h>
using namespace std;
int main(){
	int r;
	double s1,s2;
	cin>>r;
	s1=M_PI*r*r;
	s2=2*r*r;
	printf("%.6lf\n%.6lf\n",s1,s2); 
	return 0;
} 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值