poj1003

#include<iostream>

using namespace std;
int main()
{
double n,s;
int i;
while(cin>>n&&n<5.20&&n>0.01)
{
s=0,i=1; //注意不要再这定义S,I否则只初始化一次
while(s<n)
{
s+=1.0/(i+1);//注意精确度,写1的话s永远都是0,死循环
i++;
}

cout<<i-1<<" card(s)"<<endl;
}



}

posted @ 2017-05-07 10:11  mykonons  阅读(135)  评论(0编辑  收藏  举报