// 2011 07 03
// poj 1003
//daun
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
double sum = 0;
double length = 0;
cin >> length;
while(length != 0)
{
sum = 0;
for(int a = 2 ; ; a++)
{
sum += (1/(double)a);
if(length-sum <0)
{
cout << a-1 <<" card(s)"<<endl;
break;
}
}
cin >> length;
}
return 0;
}
'Code > Algorism' 카테고리의 다른 글
[ALGORISM]poj 1298 (0) | 2011.09.03 |
---|---|
[ALGORISM]poj 2853 (0) | 2011.09.03 |
[ALGORISM]poj 1077 (0) | 2011.09.03 |
[ALGORISM]poj 1163 (0) | 2011.09.03 |
[ALGORISM] poj 3085 (0) | 2011.09.03 |