Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
117185 冯瀚翔 13分数求和 C++ Accepted 1 MS 276 KB 408 2025-04-14 18:41: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(){ int h,k=2,s=1,t; double n=k*1.0/s; cin>>h; for(int i=2;i<=h;i++){ t=k; k=s+k; s=t; n=n+k*1.0/s; } printf("%.4lf",n); return 0; }