Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
129386 李鸿文添 13分数求和 C++ Accepted 1 MS 272 KB 500 2025-08-24 20:33:37

Tests(10/10):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n,fz0=2,fm0=1,fz,fm; double k=fz0*1.0/fm0; cin>>n; for(int i=2;i<=n;i++){ fz=fz0+fm0; fm=fz0; k+=fz*1.0/fm; fm0=fm; fz0=fz; } printf("%.4lf",k); return 0; }