robin88 • 1年前
using namespace std; double f(double c) {
double total=0,i=2;
int num=0;
while(total<c)
{
total=total+1/i;
i++;
num++;
}
return num;
} int main() {
double c;
while(c!=0.0)
{
cin>>c;
if(f(c)==0)
{
continue;
}
cout<<f(c)<<endl;
}
return 0;
}
评论:
请先登录,才能进行评论