Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
280801 梁睿煊 【C2-2】 编程求1+1/2+1/3+...+1/n C++ 通过 100 1 MS 240 KB 199 2024-07-11 18:15:12

Tests(5/5):


#include<bits/stdc++.h> using namespace std; int main(){ int n; double s=0,u=0; cin>>n; for(double i=1.0;i<=n;i++){ u=1/i; s=s+u; } cout<<fixed<<setprecision(3)<<s; return 0; }


测评信息: