光输出,注意格式
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
// freopen("C:\\Users\\super\\Documents\\CB_codes\\in.txt", "r", stdin);
//freopen("C:\\Users\\super\\Documents\\CB_codes\\out.txt","w",stdout);
printf("n e\n");
printf("- -----------\n");
double e = 0;
int f[10];
f[0] = 1;
for(int i = 1; i < 10; i ++ ) {
f[i] = f[i-1] * i;
// printf("%d\n",f[i]);
}
for(int i = 0; i < 10; i ++ ) {
e += (1.0 / f[i]);
if(i > 2)
printf("%d %.9lf\n",i,e);
else
printf("%d %lg\n",i,e);
}
fclose(stdin);
return 0;
}