Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
291784 田钰皓 【C2-2】 编程求1+1/2+1/3+...+1/n C++ 解答错误 0 1 MS 256 KB 188 2024-08-22 15:01:55

Tests(0/5):


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


测评信息: