Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
431874 沈昊煊 【C2-4】求恰好使s=1+1/2+1/3+…+1/n的值大于X时n的值。 C++ 通过 100 1 MS 248 KB 156 2026-03-13 20:06:31

Tests(5/5):


#include<iostream> using namespace std; int main(){ int X; double s=0,n=0; cin>>X; while(s<X){ n++; s=s+1.0/n; } cout<<n; return 0; }


测评信息: