Description
Given a circle with radius R, please calculate the area of this circle.
Input
The input contains a real number R(0.1 <= R <= 100)
Output
Output the area of the circle in a line. The answer should be rounded to 8 digits after the decimal point.
Sample Input
0.564189583547
Sample Output
1.00000000
Hint
you can assume PI = 3.14159265358979
Source
SOJ
参考答案:
#include <iostream>
#include <iomanip>//为了使用精度限制
using namespace std;
const double PI = 3.14159265358979;//无参宏定义
int main()
{
double r; cin >> r;
cout << fixed << setprecision(8) << r * r * PI << endl;//结果保留8位小数
return 0;
}