@[Glider](/space/show?uid=128861) 希望更丰富的展现?使用``Markdown``
by x义x @ 2018-09-26 19:14:36
@[Glider](/space/show?uid=128861) 朋友,首先呢,建议你使用Markdown;
然后,你这明显卡死循环了呀,兄dei;
by YWHS__LH @ 2018-09-26 19:17:22
@[Glider](/space/show?uid=128861) 这道题用int肯定是不行的呀
by YWHS__LH @ 2018-09-26 19:18:24
@[YWHS__LH](/space/show?uid=45299) 感谢
by Glider @ 2018-09-26 20:10:44
@[x義x](/space/show?uid=58567) 谢谢建议!
by Glider @ 2018-09-26 20:11:00
@[YWHS__LH](/space/show?uid=45299) 请问为什么会死循环?
by Glider @ 2018-09-26 20:20:46
@[Glider](/space/show?uid=128861) 因为如果是int类型的 比如说1/3的值是会返回0的
by YWHS__LH @ 2018-09-27 15:26:06
@[Glider](/space/show?uid=128861)
```#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
double temp,k=0.0000;
double i=1;
cin>>k;
while(temp<=k){
temp+=1.0/i;
i++;
}
cout<<i-1;
}
```
你看一下这个代码和你的区别,因为思路是很清楚的,主要就是细节的问题对啊吧
by YWHS__LH @ 2018-09-27 15:27:04
@[YWHS__LH](/space/show?uid=45299)
谢谢!
by Glider @ 2018-10-02 14:19:26