#include <iostream>  
#include <cmath>  
#include <iomanip> // 用于设置输出精度  
  
using namespace std;  
  
int main() {  
    int r;  
    cin >> r;  
  
    // 计算圆的面积  
    double area = M_PI * r * r;  
  
    // 设置输出精度为小数点后三位  
    cout << fixed << setprecision(6) << area << endl;  
  
    return 0;  
}

笔记:

pi在C++中,在<cmath> 头文件中,使用M_PI表示。