zhaozicheng @ 2017-09-03 15:03:39
#include<iostream>
using namespace std;
long double sum=0;
int n,m=1;
int main()
{
cin>>n;
while(n<=sum)
{
m++;
sum=sum+(1.0/m);
}
cout<<m;
return 0;
}
by zhaozicheng @ 2017-09-03 15:22:33
已自检出问题所在
正解:
#include<iostream>
using namespace std;
int main()
{
long double sum=0;
int n,m=0;
cin>>n;
while(n>=sum)
{
m++;
sum=sum+(1.0/m);
cout<<sum<<endl;
}
cout<<"zzc"<<m;
return 0;
}