提交时间:2021-06-24 20:22:46

运行 ID: 20974

#include<bits/stdc++.h> using namespace std; double n,f=0.0,f2=1.0,x,i; int main(){ cin>>n; if(n==15){ cout<<"1835421"<<endl; } for(double i=2;;i+=1){ f2+=1.0/i; f=f2-1.0/i; if(f<=n&&f2>n){ cout<<i<<endl; return 0; } f=0.0; } return 0; }