z940701130 @ 2018-02-24 15:31:44
int main(){ int a; scanf("%d",&a); double s =0; double i; for(i=1;;i++){ s = s + 1/i; if(s>a){ printf("%d\n",(int)i); break; } }
return 0;
}
by _newbie_ @ 2018-02-24 15:34:17
float数据范围太小
by LINLX @ 2018-02-24 15:41:05
用```开始 (Esc下面)
中间放代码
用```结束
才可以正确发出代码,不然以后别人难以找出问题。
by z940701130 @ 2018-02-24 15:46:06
@LINLX 长知识了,谢谢!
by z940701130 @ 2018-02-24 15:46:17
@newbie 感谢
by LINLX @ 2018-02-24 15:47:28
o(^-^)o
by 「ゲームとOI」 @ 2018-03-18 09:35:40
by 「ゲームとOI」 @ 2018-03-18 09:35:57
by 「ゲームとOI」 @ 2018-03-18 09:36:14
1~~~~
by 「ゲームとOI」 @ 2018-03-18 09:36:37
#include <stdio.h>
int n;
unsigned long long k;
long double tot;
int main(void)
{
k = 1;
tot = 1;
scanf("%d",&n);
while(tot <= n)
{
k ++;
tot = tot + (double)1 / (double)k;
}
printf("%d",k);
return 0;
}