Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
135158 李鸿文添 求序列的前n项和 C++ Wrong Answer 2 MS 272 KB 486 2025-11-02 17:04:15

Tests(0/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; cin>>n; double fz=2,fm=1,sum=fz/fm,fm0,fz0; for(int i=2;i<=n;i++){ fm0=fm; fz0=fz; fz=fm0+fz0; fm=fz0; sum+=fz/fm; } printf("%lf",sum); return 0; }


Run Info:

------Input------
3
------Answer-----
5.16667
------Your output-----
5.166667