http://poj.org/problem?id=1003
Idea:
n/a
Source:
int main()
{
double d;
while (1) {
//scanf("%f", &d);
cin >> d;
if (d == 0.00) break;
int k;
double cur = 0.0;
for (k = 1; k < 3000; k++) {
cur += (1 / (double)(k + 1));
if (cur > d) break;
}
cout << k << " card(s)" << endl;
}
return 0;
}
No comments:
Post a Comment