Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
91343 | 杜春雨 | 13分数求和 | C++ | Accepted | 1 MS | 272 KB | 227 | 2024-09-21 16:17:00 |
#include<bits/stdc++.h> using namespace std; int main() { int n; double s=0,a=2,b=1,t; cin>>n; for(int i=1;i<=n;i++){ s=s+a/b; t=a; a=a+b; b=t; } printf("%.4f",s); return 0; }