Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
4539 D班-汤依宁 【编程入门】编程求1+1/2+1/3+...+1/n C++ 通过 100 0 MS 260 KB 190 2025-01-12 16:37:39

Tests(1/1):


#include <bits/stdc++.h> using namespace std; int main() { double a,c=2,sum=1,d; cin>>a; for(d=0;d<a-1;d++) { sum=sum+1.0/c; c++; } cout<<setprecision(3)<<fixed<<sum; }


测评信息: