| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 140626 | 胡海峰老师 | 求序列的前n项和 | C++ | Accepted | 0 MS | 276 KB | 318 | 2025-12-18 14:16:22 |
#include <iostream> //designed by hu 2025-10 using namespace std; int main(){ int a1=2,a2=3,a,b1=1,b2=2,b; int n; cin>>n; double res=a1/(double)b1; for(int i=2;i<=n;i++){ res = res + a2/(double)b2; a = a1+a2; a1=a2; a2=a; b = b1+b2; b1=b2; b2= b; } cout<< res; return 0; }