调查问卷 @ 2017-10-02 15:22:00
#include<iostream>
using namespace std;
float s=0;
int n=1,k;
int main()
{
cin>>k;
while(s<=k)
{
s=s+1/n;
n=n+1;
}
cout<<n;
return 0;
}
by Lpy_Now @ 2017-10-02 15:55:28
scanf
by Lpy_Now @ 2017-10-02 15:55:54
开了快读也行
by 「已注销」 @ 2017-10-02 16:13:55
@a1351937368 输入输出就一个数据需要吗。。。
by Lpy_Now @ 2017-10-02 16:17:00
@王涵斌 这题不至于说TLE吧
by 「已注销」 @ 2017-10-02 16:20:25
@a1351937368 似乎暴力也是0ms
by Lpy_Now @ 2017-10-02 16:22:53
@王涵斌 对啊很好奇超时是什么鬼
by d3NtMDAw @ 2017-10-04 15:16:14
@王涵斌 你的程序貌似是_19ms_
by jokeropp @ 2017-10-07 09:55:54
是精度问题, 两个不同类型变量相除会导致超时,浮点类型要乘上个1.0再除以整型