This commit is contained in:
HuangHai
2025-08-30 18:35:01 +08:00
commit 1f397eca87
6258 changed files with 1487241 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
//读入输出优化的强迫症
ios::sync_with_stdio(false);
double sum = 0;
for (int i = 0;; i++) {
double term = 1.0 / (i * 2 + 1);
if (i % 2 == 0)sum += term;
else sum -= term;
if (term < 1e-6) break; //注意科学记数法
}
printf("%.6f\n", sum); //保留六位小数
//本程序耗时
printf("Time used = %.2f\n", (double) clock() / CLOCKS_PER_SEC);
return 0;
}