解题思路

题目中的阴影面积为

C++代码

#include<iostream>
#include<iomanip>
using namespace std;

const long double pi = 3.1415926535;

int main(){
    int n;
    while(cin >> n){
        long long square = 1LL * n * n;
        long double ans = (pi - 2) * square / 2.0;
        cout << fixed << setprecision(6) << ans << endl;
    }
    return 0;
}