倪天灿 @ 2018-08-16 14:51:54
using namespace std; int main() { int k; cin>>k; double s=0.000000; for(double i=2;i<20000000000;i++) { s+=1/i; if(s>k) { cout<<i; break; } } return 0; }
by zclclWJN @ 2018-08-16 16:20:24
洛谷自动将iostream看成了
by zclclWJN @ 2018-08-16 16:21:24
@倪天灿
#include<cstring>
#include<string>
using namespace std;
int k,n = 0;
int main()
{
cin >> k;
for(double i = 1;i <= k+1;i = i+1.0/n)
++n;
cout << n;
return 0;
}