Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
135555 何旻慧 求序列的前n项和 C++ Wrong Answer 1 MS 272 KB 469 2025-11-05 19:44:20

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(){ double n,fm,fz,fm1=1,fz1=2,sum=0; cin>>n; for(int i=1;i<=n;i++){ fm=fz1; fz=fz1+fm1; sum+=fz/fm; fm1=fm; fz1=fz; } cout<<sum; return 0; }


Run Info:

------Input------
3
------Answer-----
5.16667
------Your output-----
4.76667