Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
135556 李茗宇 求序列的前n项和 C++ Accepted 1 MS 268 KB 458 2025-11-05 19:44:57

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