Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
7656 | luchenyuan | 求出e的值 | C++ | 编译错误 | 0 MS | 0 KB | 362 | 2023-02-06 08:08:00 |
#include<iostream> #inlucde<iomanip> using namespace std; int main() { int n; cin >> n; int e=0; int k=1; int product=1; for (int i=1; i<=n; i++) { for (int j=1; j<=k; j++) { product*=j; j++; } e+=1/product; k++; } cout << fixed << setprecision(10) << e; }