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 |
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