Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
335520 李俞家骅 【C2-4】求恰好使s=1+1/2+1/3+…+1/n的值大于X时n的值。 C++ 通过 100 2 MS 252 KB 178 2025-07-23 10:44:41

Tests(5/5):


#include<bits/stdc++.h> using namespace std; int main(){ double s=0; int x,n=1; cin>>x; while(s<=x){ s+=1.0/n; n++; } cout<<n-1; return 0; }


测评信息: