Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
114914 胡海峰老师 13分数求和 C Accepted 1 MS 200 KB 291 2025-03-24 20:40:29

Tests(10/10):


Code:

#include<stdio.h> int main(){ int n; scanf("%d",&n); //a/b int a,b,tmp; a = 2; b = 1 ; float s= a/(float)b; //5/3=====1 for( int i=2;i<=n;i++) { tmp = a +b; b = a; a = tmp; s = s + (float)a/ b; } printf("%.4f",s); return 0; }