Create 1045.cpp

This commit is contained in:
Kirigaya Kazuto 2016-04-10 21:13:21 +08:00
parent 3cdd8f5d94
commit 6b89ca4332

29
ZOJ/1045.cpp Normal file
View File

@ -0,0 +1,29 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
double pool[300];
int main()
{
pool[1]=0.5;
for(int i=2;i<300;i++)
{
pool[i]=pool[i-1]+1.0/(i+1);
}
double inp;
while(scanf("%lf",&inp)==1&&inp>0.01)
{
for(int i=1;i<300;i++)
{
if(pool[i]>inp)
{
printf("%d card(s)\n",i);
break;
}
}
}
return 0;
}