mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
30 lines
478 B
C++
30 lines
478 B
C++
|
#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;
|
||
|
}
|