Mizuiro79 @ 2020-12-24 17:07:25
#include<iostream>
using namespace std;
int main()
{
int k,n=0,sum=0;
cin>>k;
while(sum<=k)
{
n++;
sum+=sum+(1/n);
}
cout<<n<<endl;
return 0;
}
by ethan_zhou @ 2020-12-24 17:08:06
sum+=sum+(1/n);
错了
by _OJF_ @ 2020-12-24 17:08:56
@江澂子、堯 编译器里能过?太神奇了
好吧sum要用浮点类型(float或double)
by CGDGAD @ 2020-12-24 17:22:03
编译器里可以通过
by MyukiyoMekya @ 2020-12-24 17:45:51
@chengzhiyu蒻蒟 编译器咋知道你是要求所有向下取整的和还是直接求和