- 题解
1
- 2024-3-3 15:04:40 @
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a=1;
double pi=0,b=1;
for(int i=1;b >= 0.000001;i=i+2)
{
b=1.0/i;
pi=pi+4*a*b;
a=(-1)*a;
}
printf("%.6f",pi);
return 0;
}
0 comments
No comments so far...