mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 1045.cpp
This commit is contained in:
parent
3cdd8f5d94
commit
6b89ca4332
29
ZOJ/1045.cpp
Normal file
29
ZOJ/1045.cpp
Normal 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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user