Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
114120 翁思宸 求序列的前n项和 C++ Accepted 1 MS 280 KB 437 2025-03-21 19:52:11

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