| Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 77649 | sh25_wuyy | 求出e的值 | C++ | 通过 | 0 MS | 248 KB | 468 | 2025-12-26 14:35:38 |
#include <iostream> #include <iomanip> using namespace std; int main() { int n; cin >> n; if (n < 2 || n > 15) { cout << "输入错误:n应该在2到15之间" << endl; return 1; } double e = 1.0; double factorial = 1.0; for (int i = 1; i <= n; i++) { factorial *= i; e += 1.0 / factorial; } cout << fixed << setprecision(10) << e << endl; return 0; }