Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
138511 向俊麒 求序列的前n项和 C++ Wrong Answer 0 MS 272 KB 470 2025-11-25 19:06:16

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 a=2,b=1,a2=3,b2=2,a3,b3,n,h=0; cin>>n; for(int i=1;i<=n;i++){ a3=a+a2; b=b2; a2=a3; b3=b+b2; b=b2; b2=b3; h=a+a2+b+b2; }cout<<h; return 0; }


Run Info:

------Input------
3
------Answer-----
5.16667
------Your output-----
35