倪天灿 @ 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 Drinkkk @ 2018-08-16 14:55:25
@倪天灿 希望更丰富的展现?使用Markdown
by Drinkkk @ 2018-08-16 15:16:40
RE=Runtime Error
by zclclWJN @ 2018-08-16 15:25:36
我怎么觉得#没加上呢
by 倪天灿 @ 2018-08-16 15:28:23
有#号的,倍洛谷吃了
by 勇敢的我 @ 2018-08-16 15:28:26
@zclclWJN #号被Markdown当成标题了
by zclclWJN @ 2018-08-16 15:31:05
k改成long long
#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
long long k;
double s = 0.000000;
int main()
{
cin >> k;
for(double i=2;i<20000000000;i++)
{
s += 1/i;
if(s > k)
{
cout << i;
break;
}
}
return 0;
}
int最大为2147483647
by zclclWJN @ 2018-08-16 15:31:21
好吧
by 倪天灿 @ 2018-08-16 16:02:19
@zclclWJN 没用啊
by zclclWJN @ 2018-08-16 16:05:28
@倪天灿 话说是哪一题
by 倪天灿 @ 2018-08-16 16:06:16
这一提