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

Tests(1/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/i; } cout<<fixed<<setprecision(3)<<s; return 0; }


测评信息:

输入

                    

输出

                    

答案

                    

系统信息

exit code: 0, checker exit code: 0

输入

2

输出

1.000

答案

1.500

系统信息

exit code: 0, checker exit code: 0