Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
338257 | 李明灿 | 【C2-4】求恰好使s=1+1/2+1/3+…+1/n的值大于X时n的值。 | C++ | 通过 | 100 | 3 MS | 248 KB | 227 | 2025-08-06 21:39:05 |
#include <iostream> using namespace std; int main() { int x; cin>>x; double s=0; int n=0; while (s<=x) { n++; s+=1.0/n; } cout<<n<<endl; return 0; }