Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
30339 | diandian | 求出e的值 | C++ | 通过 | 0 MS | 240 KB | 278 | 2023-11-06 21:11:27 |
#include <bits/stdc++.h> using namespace std; int main() { int n; double a = 1.0; cin >> n; for (int i = 1; i <= n; ++ i) { long long q = 1; for (int j = 1; j <= i; ++ j) q *= j; a += 1.0 / q; } cout << fixed << setprecision(10) << a; return 0; }